Simplify handleAnonymousVersion even more.

We used to create a vector contantaining all version definitions
with wildcards because doing that was efficient. All patterns were
compiled to a regexp and matched against symbol names. Because
a regexp can be converted to a DFA, matching against union of patterns
is as cheap as matching against one patter.

We are no longer converting them to regexp. Our own glob pattern
handler doesn't do such optimization. Therefore, creating a vector
no longer makes sense.

llvm-svn: 287196
This commit is contained in:
Rui Ueyama 2016-11-17 03:19:34 +00:00
parent fd264f7e84
commit 77d917de57
1 changed files with 2 additions and 5 deletions

View File

@ -634,18 +634,15 @@ SymbolTable<ELFT>::findAllDemangled(const StringMatcher &M) {
// in the form of { global: foo; bar; local *; }. So, local is default.
// In this function, we make specified symbols global.
template <class ELFT> void SymbolTable<ELFT>::handleAnonymousVersion() {
std::vector<StringRef> Patterns;
for (SymbolVersion &Ver : Config->VersionScriptGlobals) {
if (hasWildcard(Ver.Name)) {
Patterns.push_back(Ver.Name);
for (SymbolBody *B : findAll(StringMatcher({Ver.Name})))
B->symbol()->VersionId = VER_NDX_GLOBAL;
continue;
}
if (SymbolBody *B = find(Ver.Name))
B->symbol()->VersionId = VER_NDX_GLOBAL;
}
if (!Patterns.empty())
for (SymbolBody *B : findAll(StringMatcher(Patterns)))
B->symbol()->VersionId = VER_NDX_GLOBAL;
}
// Set symbol versions to symbols. This function handles patterns