<div dir="ltr">On second thought, I don't actually like this change... Sorry about not saying that in review, but this is too clever. Do you mind if I ask you to revert?</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 3, 2018 at 5:09 AM George Rimar via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: grimar<br>
Date: Tue Apr  3 05:06:29 2018<br>
New Revision: 329060<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=329060&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=329060&view=rev</a><br>
Log:<br>
[ELF] - Simplify createFiles. NFCI.<br>
<br>
Groups paired options together.<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D45090" rel="noreferrer" target="_blank">https://reviews.llvm.org/D45090</a><br>
<br>
Modified:<br>
    lld/trunk/ELF/Driver.cpp<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=329060&r1=329059&r2=329060&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=329060&r1=329059&r2=329060&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Tue Apr  3 05:06:29 2018<br>
@@ -879,7 +879,8 @@ static bool getBinaryOption(StringRef S)<br>
<br>
 void LinkerDriver::createFiles(opt::InputArgList &Args) {<br>
   for (auto *Arg : Args) {<br>
-    switch (Arg->getOption().getUnaliasedOption().getID()) {<br>
+    unsigned ID = Arg->getOption().getUnaliasedOption().getID();<br>
+    switch (ID) {<br>
     case OPT_library:<br>
       addLibrary(Arg->getValue());<br>
       break;<br>
@@ -902,25 +903,19 @@ void LinkerDriver::createFiles(opt::Inpu<br>
       error(Twine("cannot find linker script ") + Arg->getValue());<br>
       break;<br>
     case OPT_as_needed:<br>
-      Config->AsNeeded = true;<br>
+    case OPT_no_as_needed:<br>
+      Config->AsNeeded = (ID == OPT_as_needed);<br>
       break;<br>
     case OPT_format:<br>
       InBinary = getBinaryOption(Arg->getValue());<br>
       break;<br>
-    case OPT_no_as_needed:<br>
-      Config->AsNeeded = false;<br>
-      break;<br>
     case OPT_Bstatic:<br>
-      Config->Static = true;<br>
-      break;<br>
     case OPT_Bdynamic:<br>
-      Config->Static = false;<br>
+      Config->Static = (ID == OPT_Bstatic);<br>
       break;<br>
     case OPT_whole_archive:<br>
-      InWholeArchive = true;<br>
-      break;<br>
     case OPT_no_whole_archive:<br>
-      InWholeArchive = false;<br>
+      InWholeArchive = (ID == OPT_whole_archive);<br>
       break;<br>
     case OPT_just_symbols:<br>
       if (Optional<MemoryBufferRef> MB = readFile(Arg->getValue())) {<br>
@@ -929,10 +924,8 @@ void LinkerDriver::createFiles(opt::Inpu<br>
       }<br>
       break;<br>
     case OPT_start_lib:<br>
-      InLib = true;<br>
-      break;<br>
     case OPT_end_lib:<br>
-      InLib = false;<br>
+      InLib = (ID == OPT_start_lib);<br>
       break;<br>
     }<br>
   }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>