summaryrefslogtreecommitdiff
path: root/lib/Object/Archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/Archive.cpp')
-rw-r--r--lib/Object/Archive.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp
index cdf987a320..2393ade562 100644
--- a/lib/Object/Archive.cpp
+++ b/lib/Object/Archive.cpp
@@ -186,20 +186,19 @@ Archive::Child::getAsBinary(LLVMContext *Context) const {
return createBinary(Buff, Context);
}
-ErrorOr<Archive*> Archive::create(MemoryBuffer *Source) {
+ErrorOr<Archive *> Archive::create(std::unique_ptr<MemoryBuffer> Source) {
std::error_code EC;
- std::unique_ptr<Archive> Ret(new Archive(Source, EC));
+ std::unique_ptr<Archive> Ret(new Archive(std::move(Source), EC));
if (EC)
return EC;
return Ret.release();
}
-Archive::Archive(MemoryBuffer *source, std::error_code &ec)
- : Binary(Binary::ID_Archive, source), SymbolTable(child_end()) {
+Archive::Archive(std::unique_ptr<MemoryBuffer> Source, std::error_code &ec)
+ : Binary(Binary::ID_Archive, std::move(Source)), SymbolTable(child_end()) {
// Check for sufficient magic.
- assert(source);
- if (source->getBufferSize() < 8 ||
- StringRef(source->getBufferStart(), 8) != Magic) {
+ if (Data->getBufferSize() < 8 ||
+ StringRef(Data->getBufferStart(), 8) != Magic) {
ec = object_error::invalid_file_type;
return;
}