[PATCH] D17269: [ELF] - Implemented linkerscript sections padding.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 01:44:44 PST 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:74-75
@@ -64,1 +73,4 @@
+  auto E = OutSections.end();
+  auto I = std::find_if(OutSections.begin(), E, FindSec{A});
+  auto J = std::find_if(OutSections.begin(), E, FindSec{B});
   if (I == E || J == E)
----------------
ruiu wrote:
> This is a bit odd way of doing it because we can use lambdas.
> 
>   auto I = std::find_if(Begin, End, [](OutSection &C) { return C.Name == A; });
>   auto J = std::find_if(Begin, End, [](OutSection &C) { return C.Name == B; });
> 
That because I used this functor in getFiller() either before. 
Not sure that labdas are looking better here now.

btw that can be something like:

```
 OutSection *I = nullptr;
 OutSection *J = nullptr;
 for (OutSection &C : OutSections) {
   if (!I && C.Name == A)
     I = &C;
   if (!J && C.Name == B)
     J = &C;
   if (I && J)
     return I < J ? -1 : 1;
 }
 return 0;
```



http://reviews.llvm.org/D17269





More information about the llvm-commits mailing list