[PATCH] D45090: [ELF] - Simplify createFiles.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 30 07:28:36 PDT 2018
grimar created this revision.
grimar added reviewers: ruiu, espindola.
Herald added subscribers: arichardson, emaste.
I suggest doing this change to
group paired options together.
https://reviews.llvm.org/D45090
Files:
ELF/Driver.cpp
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -869,7 +869,8 @@
void LinkerDriver::createFiles(opt::InputArgList &Args) {
for (auto *Arg : Args) {
- switch (Arg->getOption().getUnaliasedOption().getID()) {
+ unsigned ID = Arg->getOption().getUnaliasedOption().getID();
+ switch (ID) {
case OPT_library:
addLibrary(Arg->getValue());
break;
@@ -892,37 +893,29 @@
error(Twine("cannot find linker script ") + Arg->getValue());
break;
case OPT_as_needed:
- Config->AsNeeded = true;
+ case OPT_no_as_needed:
+ Config->AsNeeded = ID == OPT_as_needed;
break;
case OPT_format:
InBinary = getBinaryOption(Arg->getValue());
break;
- case OPT_no_as_needed:
- Config->AsNeeded = false;
- break;
case OPT_Bstatic:
- Config->Static = true;
- break;
case OPT_Bdynamic:
- Config->Static = false;
+ Config->Static = ID == OPT_Bstatic;
break;
case OPT_whole_archive:
- InWholeArchive = true;
- break;
case OPT_no_whole_archive:
- InWholeArchive = false;
+ InWholeArchive = ID == OPT_whole_archive;
break;
case OPT_just_symbols:
if (Optional<MemoryBufferRef> MB = readFile(Arg->getValue())) {
Files.push_back(createObjectFile(*MB));
Files.back()->JustSymbols = true;
}
break;
case OPT_start_lib:
- InLib = true;
- break;
case OPT_end_lib:
- InLib = false;
+ InLib = ID == OPT_start_lib;
break;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45090.140424.patch
Type: text/x-patch
Size: 1630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180330/d5f8d056/attachment.bin>
More information about the llvm-commits
mailing list