<div dir="ltr">I think this change is at least not negative. Hopefully slightly positive by showing how we use the first element of the pair early.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 3:57 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Feb 10, 2016 at 3:43 PM, Rui Ueyama 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: ruiu<br>
Date: Wed Feb 10 17:43:16 2016<br>
New Revision: 260467<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=260467&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=260467&view=rev</a><br>
Log:<br>
Reorder code to improve readability. NFC.<br></blockquote><div><br></div></span><div>That seems like a strange change for readability - it's pretty canonical to write a lambda where it's used, rather naming it only to use it in one place anyway... <br><br>The idea is to think of functions taking lambdas as somewhat like an existing control flow (while, if, etc) - this works particularly well when the functor argument is the last one in a call (& clang-format is designed for this case) as it was in the original code here.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    lld/trunk/ELF/OutputSections.cpp<br>
<br>
Modified: lld/trunk/ELF/OutputSections.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=260467&r1=260466&r2=260467&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=260467&r1=260466&r2=260467&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/OutputSections.cpp (original)<br>
+++ lld/trunk/ELF/OutputSections.cpp Wed Feb 10 17:43:16 2016<br>
@@ -769,12 +769,12 @@ static int getPriority(StringRef S) {<br>
 template <class ELFT> void OutputSection<ELFT>::sortByPriority() {<br>
   // Sort sections by priority.<br>
   typedef std::pair<int, InputSection<ELFT> *> Pair;<br>
+  auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; };<br>
+<br>
   std::vector<Pair> V;<br>
   for (InputSection<ELFT> *S : Sections)<br>
     V.push_back({getPriority(S->getSectionName()), S});<br>
-  std::stable_sort(V.begin(), V.end(), [](const Pair &A, const Pair &B) {<br>
-    return A.first < B.first;<br>
-  });<br>
+  std::stable_sort(V.begin(), V.end(), Comp);<br>
   Sections.clear();<br>
   for (Pair &P : V)<br>
     Sections.push_back(P.second);<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></div></div><br></div></div>
</blockquote></div><br></div>