[PATCH] D45090: [ELF] - Simplify createFiles.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 05:09:24 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD329060: [ELF] - Simplify createFiles. NFCI. (authored by grimar, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45090?vs=140424&id=140763#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45090

Files:
  ELF/Driver.cpp


Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -879,7 +879,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;
@@ -902,37 +903,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.140763.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180403/c09bc32b/attachment.bin>


More information about the llvm-commits mailing list