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:
parent
bf6007bd1b
commit
58841b45d0
|
@ -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());
|
||||
|
|
|
@ -49,7 +49,6 @@ private:
|
|||
bool InBinary = false;
|
||||
|
||||
std::vector<InputFile *> Files;
|
||||
std::vector<std::unique_ptr<MemoryBuffer>> OwningMBs;
|
||||
};
|
||||
|
||||
// Parses command line options.
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue