Remove Driver::OwningMB and instead use make().

We managed new MemoryBuffers in different ways in LinkerScript.cpp and
Driver.cpp. With this patch, they are managed in the same way.

llvm-svn: 290411
This commit is contained in:
Rui Ueyama 2016-12-23 03:19:09 +00:00
parent bf6007bd1b
commit 58841b45d0
3 changed files with 5 additions and 5 deletions

View File

@ -122,7 +122,7 @@ LinkerDriver::getArchiveMembers(MemoryBufferRef MB) {
// Take ownership of memory buffers created for members of thin archives.
for (std::unique_ptr<MemoryBuffer> &MB : File->takeThinBuffers())
OwningMBs.push_back(std::move(MB));
make<std::unique_ptr<MemoryBuffer>>(std::move(MB));
return V;
}
@ -180,7 +180,7 @@ Optional<MemoryBufferRef> LinkerDriver::readFile(StringRef Path) {
}
std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
MemoryBufferRef MBRef = MB->getMemBufferRef();
OwningMBs.push_back(std::move(MB)); // take MB ownership
make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take MB ownership
if (Cpio)
Cpio->append(relativeToRoot(Path), MBRef.getBuffer());

View File

@ -49,7 +49,6 @@ private:
bool InBinary = false;
std::vector<InputFile *> Files;
std::vector<std::unique_ptr<MemoryBuffer>> OwningMBs;
};
// Parses command line options.

View File

@ -1184,8 +1184,9 @@ void ScriptParser::readInclude() {
setError("cannot open " + Tok);
return;
}
std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
tokenize({Saver.save(MB->getBuffer()), unquote(Tok)});
MemoryBufferRef MBRef = (*MBOrErr)->getMemBufferRef();
make<std::unique_ptr<MemoryBuffer>>(std::move(*MBOrErr)); // take MB ownership
tokenize(MBRef);
}
void ScriptParser::readOutput() {