COFF: Make the Driver own all MemoryBuffers. NFC.
Previously, a MemoryBuffer of a file was owned by each InputFile object.
This patch makes the Driver own all of them. InputFiles now have only
MemoryBufferRefs. This change simplifies ownership managment
(particularly for ObjectFile -- the object owned a MemoryBuffer only when
it's not created from an archive file, because in that case a parent
archive file owned the entire buffer. Now it owns nothing unconditionally.)
llvm-svn: 238690
diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp
index 4fd3451..8bd5e65 100644
--- a/lld/COFF/Symbols.cpp
+++ b/lld/COFF/Symbols.cpp
@@ -87,7 +87,7 @@
if (Magic != file_magic::coff_object)
return make_dynamic_error_code("unknown file type");
- std::unique_ptr<InputFile> Obj(new ObjectFile(MBRef.getBufferIdentifier(), MBRef));
+ std::unique_ptr<InputFile> Obj(new ObjectFile(MBRef));
Obj->setParentName(File->getName());
return std::move(Obj);
}