[lld] r290411 - Remove Driver::OwningMB and instead use make().
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 19:19:09 PST 2016
Author: ruiu
Date: Thu Dec 22 21:19:09 2016
New Revision: 290411
URL: http://llvm.org/viewvc/llvm-project?rev=290411&view=rev
Log:
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.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Driver.h
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=290411&r1=290410&r2=290411&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Dec 22 21:19:09 2016
@@ -122,7 +122,7 @@ LinkerDriver::getArchiveMembers(MemoryBu
// 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::
}
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());
Modified: lld/trunk/ELF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.h?rev=290411&r1=290410&r2=290411&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.h (original)
+++ lld/trunk/ELF/Driver.h Thu Dec 22 21:19:09 2016
@@ -49,7 +49,6 @@ private:
bool InBinary = false;
std::vector<InputFile *> Files;
- std::vector<std::unique_ptr<MemoryBuffer>> OwningMBs;
};
// Parses command line options.
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=290411&r1=290410&r2=290411&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Dec 22 21:19:09 2016
@@ -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() {
More information about the llvm-commits
mailing list