[lld] r284695 - Remove an optional parameter from LinkerDriver::addFile to simplify.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 22:03:50 PDT 2016
Author: ruiu
Date: Thu Oct 20 00:03:49 2016
New Revision: 284695
URL: http://llvm.org/viewvc/llvm-project?rev=284695&view=rev
Log:
Remove an optional parameter from LinkerDriver::addFile to simplify.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Driver.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=284695&r1=284694&r2=284695&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Oct 20 00:03:49 2016
@@ -117,17 +117,15 @@ LinkerDriver::getArchiveMembers(MemoryBu
// Opens and parses a file. Path has to be resolved already.
// Newly created memory buffers are owned by this driver.
-void LinkerDriver::addFile(StringRef Path, bool KnownScript) {
+void LinkerDriver::addFile(StringRef Path) {
using namespace sys::fs;
- if (Config->Verbose)
- outs() << Path << "\n";
Optional<MemoryBufferRef> Buffer = readFile(Path);
if (!Buffer.hasValue())
return;
MemoryBufferRef MBRef = *Buffer;
- if (Config->Binary && !KnownScript) {
+ if (Config->Binary) {
Files.push_back(new BinaryFile(MBRef));
return;
}
@@ -160,6 +158,9 @@ void LinkerDriver::addFile(StringRef Pat
}
Optional<MemoryBufferRef> LinkerDriver::readFile(StringRef Path) {
+ if (Config->Verbose)
+ outs() << Path << "\n";
+
auto MBOrErr = MemoryBuffer::getFile(Path);
if (auto EC = MBOrErr.getError()) {
error(EC, "cannot open " + Path);
@@ -603,7 +604,8 @@ void LinkerDriver::createFiles(opt::Inpu
break;
case OPT_alias_script_T:
case OPT_script:
- addFile(Arg->getValue(), true);
+ if (Optional<MemoryBufferRef> MB = readFile(Arg->getValue()))
+ readLinkerScript(*MB);
break;
case OPT_as_needed:
Config->AsNeeded = true;
Modified: lld/trunk/ELF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.h?rev=284695&r1=284694&r2=284695&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.h (original)
+++ lld/trunk/ELF/Driver.h Thu Oct 20 00:03:49 2016
@@ -28,7 +28,7 @@ extern class LinkerDriver *Driver;
class LinkerDriver {
public:
void main(ArrayRef<const char *> Args);
- void addFile(StringRef Path, bool KnownScript = false);
+ void addFile(StringRef Path);
void addLibrary(StringRef Name);
llvm::LLVMContext Context; // to parse bitcode files
std::unique_ptr<CpioFile> Cpio; // for reproduce
More information about the llvm-commits
mailing list