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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 06:27:15 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:259
@@ +258,3 @@
+            AddInputSec(S, OutCmd->Name);
+            break;
+          }
----------------
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;
}
```


https://reviews.llvm.org/D22617





More information about the llvm-commits mailing list