<div dir="ltr">Nice. Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 12, 2016 at 9:05 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Mon Sep 12 11:05:16 2016<br>
New Revision: 281222<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=281222&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=281222&view=rev</a><br>
Log:<br>
Simplify handling of /DISCARD/. NFC.<br>
<br>
Modified:<br>
    lld/trunk/ELF/LinkerScript.cpp<br>
    lld/trunk/ELF/LinkerScript.h<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=281222&r1=281221&r2=281222&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.cpp?rev=281222&<wbr>r1=281221&r2=281222&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.cpp (original)<br>
+++ lld/trunk/ELF/LinkerScript.cpp Mon Sep 12 11:05:16 2016<br>
@@ -149,14 +149,10 @@ getComparator(SortKind K) {<br>
 }<br>
<br>
 template <class ELFT><br>
-void LinkerScript<ELFT>::discard(<wbr>OutputSectionCommand &Cmd) {<br>
-  for (const std::unique_ptr<BaseCommand> &Base : Cmd.Commands) {<br>
-    if (auto *Cmd = dyn_cast<<wbr>InputSectionDescription>(Base.<wbr>get())) {<br>
-      for (InputSectionBase<ELFT> *S : getInputSections(Cmd)) {<br>
-        S->Live = false;<br>
-        reportDiscarded(S);<br>
-      }<br>
-    }<br>
+void LinkerScript<ELFT>::discard(<wbr>ArrayRef<InputSectionBase<<wbr>ELFT> *> V) {<br>
+  for (InputSectionBase<ELFT> *S : V) {<br>
+    S->Live = false;<br>
+    reportDiscarded(S);<br>
   }<br>
 }<br>
<br>
@@ -228,12 +224,13 @@ void LinkerScript<ELFT>::<wbr>createSections(<br>
     }<br>
<br>
     if (auto *Cmd = dyn_cast<OutputSectionCommand><wbr>(Base1.get())) {<br>
+      std::vector<InputSectionBase<<wbr>ELFT> *> V = createInputSectionList(*Cmd);<br>
+<br>
       if (Cmd->Name == "/DISCARD/") {<br>
-        discard(*Cmd);<br>
+        discard(V);<br>
         continue;<br>
       }<br>
<br>
-      std::vector<InputSectionBase<<wbr>ELFT> *> V = createInputSectionList(*Cmd);<br>
       if (V.empty())<br>
         continue;<br>
<br>
<br>
Modified: lld/trunk/ELF/LinkerScript.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=281222&r1=281221&r2=281222&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.h?rev=281222&r1=<wbr>281221&r2=281222&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.h (original)<br>
+++ lld/trunk/ELF/LinkerScript.h Mon Sep 12 11:05:16 2016<br>
@@ -188,7 +188,7 @@ private:<br>
   std::vector<InputSectionBase<<wbr>ELFT> *><br>
   getInputSections(const InputSectionDescription *);<br>
<br>
-  void discard(OutputSectionCommand &Cmd);<br>
+  void discard(ArrayRef<<wbr>InputSectionBase<ELFT> *> V);<br>
<br>
   std::vector<InputSectionBase<<wbr>ELFT> *><br>
   createInputSectionList(<wbr>OutputSectionCommand &Cmd);<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">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/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>