[PATCH] D23829: [ELF] - Use std::regex instead of hand written logic in elf::globMatch()

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 04:05:10 PDT 2016


grimar added inline comments.

================
Comment at: ELF/LinkerScript.cpp:130-132
@@ -129,3 +129,5 @@
 
-  if (llvm::find(Patterns, "COMMON") != Patterns.end())
+  if (llvm::find_if(Patterns, [](const std::regex &P) {
+        return globMatch(P, "COMMON");
+      }) != Patterns.end())
     Ret.push_back(CommonInputSection<ELFT>::X);
----------------
ruiu wrote:
> Isn't this slow?
I think this should not be slow. Even FreeBSD script
which I think is from largest group there are ~150 input sections pattern in total.
That is not huge amount itself.
I think 99% of them starts from "." (a dot, not a any character, like ".data" will have pattern "\.data")
And matching should end on first symbol comparsion for most of them ('C' vs '.').
Am I missing something here ?


https://reviews.llvm.org/D23829





More information about the llvm-commits mailing list