diff options
author | Fangrui Song <maskray@google.com> | 2020-06-17 17:11:38 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-06-17 17:12:10 -0700 |
commit | 49279ca160183c1567e2637f88f3e92eb458c3e7 (patch) | |
tree | 466d8244466f0f4cc4252148b61934c0734aa560 /lld/ELF/ScriptParser.cpp | |
parent | 7ee758d691b2afc2f130ba3a8f8507fb6415f1d9 (diff) | |
download | llvm-49279ca160183c1567e2637f88f3e92eb458c3e7.zip llvm-49279ca160183c1567e2637f88f3e92eb458c3e7.tar.gz llvm-49279ca160183c1567e2637f88f3e92eb458c3e7.tar.bz2 |
[ELF] Improve --export-dynamic-symbol performance by checking whether wildcard is really used
A hasWildcard pattern iterates over symVector, which can be slow when there
are many --export-dynamic-symbol. In optimistic cases, most patterns don't use
a wildcard character. hasWildcard: false can avoid a symbol table iteration.
While here, add two tests using `[` and `?`, respectively.
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index d23a46d2..fea6b7a 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -1474,7 +1474,7 @@ void ScriptParser::readVersionDeclaration(StringRef verStr) { expect(";"); } -static bool hasWildcard(StringRef s) { +bool elf::hasWildcard(StringRef s) { return s.find_first_of("?*[") != StringRef::npos; } |