Make File always take the ownership of a MemoryBuffer.
authorRui Ueyama <ruiu@google.com>
Fri, 12 Dec 2014 10:27:33 +0000 (10:27 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 12 Dec 2014 10:27:33 +0000 (10:27 +0000)
commit961f43fb70f65a2697f67c6857587608a888e6cb
tree65cfb4deeb6eed7c6705ebee605de30173cdb968
parent11a0ac66e10658f9eec87db0e846f6f5eaafc9cf
Make File always take the ownership of a MemoryBuffer.

The documentation of parseFile() said that "the resulting File
object may take ownership of the MemoryBuffer." So, whether or not
the ownership of a MemoryBuffer would be taken was not clear.
A FileNode (a subclass of InputElement, which is being deprecated)
keeps the ownership if a File doesn't take it.

This patch makes File always take the ownership of a buffer.
Buffers lifespan is not always the same as File instances.
Files are able to deallocate buffers after parsing the contents.

llvm-svn: 224113
21 files changed:
lld/include/lld/Core/File.h
lld/include/lld/Core/InputGraph.h
lld/include/lld/Driver/CoreInputGraph.h
lld/include/lld/Driver/DarwinInputGraph.h
lld/include/lld/ReaderWriter/Reader.h
lld/lib/Core/InputGraph.cpp
lld/lib/Driver/DarwinInputGraph.cpp
lld/lib/Driver/GnuLdInputGraph.cpp
lld/lib/Driver/WinLinkInputGraph.cpp
lld/lib/Passes/RoundTripNativePass.cpp
lld/lib/Passes/RoundTripYAMLPass.cpp
lld/lib/ReaderWriter/ELF/ELFReader.h
lld/lib/ReaderWriter/ELF/Mips/MipsELFReader.h
lld/lib/ReaderWriter/FileArchive.cpp
lld/lib/ReaderWriter/MachO/File.h
lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
lld/lib/ReaderWriter/Native/ReaderNative.cpp
lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
lld/lib/ReaderWriter/Reader.cpp
lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp