[PATCH] D72517: [lld/ELF] PR44498: Support input filename in double quote

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 15:13:31 PST 2020


thopre marked 4 inline comments as done.
thopre added a comment.

In D72517#1823830 <https://reviews.llvm.org/D72517#1823830>, @evgeny777 wrote:

> I think that adding extra flag to GlobPattern::create was better idea. Just set it to false by default, so that GlobPattern will still act as glob matcher for all other users:
>
>   static static Expected<GlobPattern> create(StringRef Pat, bool IgnoreMetaChars = false);
>
>
> Than add extra constructor to StringMatcher to which you'll pass GlobPattern and use it from InputSectionDescription constructor.


Actually I agree with Fangrui. Having GlobPattern do any match other than globbing would be counter-intuitive given the name. A user who doesn't want globbing just use an exact match. I'm not opposed to create a new wrapper class around GlobPattern that would allow exact match with a name that reflect that matching duality. Maybe simply PatternMatcher?



================
Comment at: lld/ELF/ScriptParser.cpp:849
       auto *isd = make<InputSectionDescription>(tok);
-      isd->sectionPatterns.push_back({{}, StringMatcher({"*"})});
+      isd->sectionPatterns.push_back({{}, StringMatcher("*")});
       cmd->sectionCommands.push_back(isd);
----------------
evgeny777 wrote:
> What's the purpose of this change?
I've changed StringMatcher to only take a single pattern to avoid changing the array of pattern for an array of pair (pattern + exact match boolean) which would make the interface more cumbersome to use *and* implement. All callers passing an array were constructing it in a loop with push_back which I've changed for a call to a new addPattern.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72517/new/

https://reviews.llvm.org/D72517





More information about the llvm-commits mailing list