[PATCH] D66613: [support][llvm-objcopy] Add support for shell wildcards

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 18:37:26 PDT 2019


MaskRay added a comment.

I just realized that you can remove the glob (I'd call it glob, not wildcard) change from this patch, and just use `lib/Support/Regex.cpp:GlobPattern`.

`GlobPattern` is currently used by lld to do version script/dynamic list matching. In version scripts/dynamic lists, `[:` and `[=` are syntax error (ld.bfd), and I don't think anyone using `[.`. But to make it fully `fnmatch(pat, str, 0)` capable (in case someone uses character classes like `[[:digit:]]`), you can add these enhancement to a separate change.



================
Comment at: llvm/lib/Support/Regex.cpp:247
+    Wildcard = Wildcard.drop_front();
+    *RegexStr += "^";
+  }
----------------
character `'^'` may be slightly better/faster.


================
Comment at: llvm/lib/Support/Regex.cpp:268
+  if (Wildcard.consume_front("]"))
+    *RegexStr += "]";
+
----------------
character ']'


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66613





More information about the llvm-commits mailing list