[PATCH] D22617: [ELF] - Linkerscript: add InputSectionDescription command to LS parser.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 06:36:38 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:259
@@ +258,3 @@
+            AddInputSec(S, OutCmd->Name);
+            break;
+          }
----------------
grimar wrote:
> ruiu wrote:
> > grimar wrote:
> > > ruiu wrote:
> > > > `break` at end of a for-loop?
> > > Yes, break. I need to exit this loop after first AddInputSec. As we do not want to add the section again if there are multiple pattern matches.
> > > That was why I used std::find_if in previous iteration.
> > > May be worth to revert to previous version ?
> > You can define a function taking two parameters, a stringref and an arrayref of stringref, which returns true if the former string glob-matches one of the latter strings.
> What about next ?
> 
> 
> ```
> static bool hasGlobMatch(StringRef T, ArrayRef<StringRef> L) {
>   for (StringRef S : L)
>     if (globMatch(S, T))
>       return true;
>   return false;
> }
> ```
That's what I meant. (a few nits are: I'd name the function `match` because "GlobMatch" is not an object or a thing, rename T Pattern, and swap T and L to match the parameter order of globMatch.)


https://reviews.llvm.org/D22617





More information about the llvm-commits mailing list