From bac1c3ce85e1b9c489101b13395bb9a453691ac5 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 17 Nov 2016 16:48:53 +0000 Subject: [PATCH] Pass StringRefs instead of StringMatcher because it's simpler. llvm-svn: 287234 --- lld/ELF/SymbolTable.cpp | 11 ++++++----- lld/ELF/SymbolTable.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index b97fbbc..d7e7a94 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -488,8 +488,9 @@ template SymbolBody *SymbolTable::find(StringRef Name) { // Returns a list of defined symbols that match with a given pattern. template -std::vector SymbolTable::findAll(const StringMatcher &M) { +std::vector SymbolTable::findAll(StringRef GlobPat) { std::vector Res; + StringMatcher M({GlobPat}); for (Symbol *Sym : SymVector) { SymbolBody *B = Sym->body(); StringRef Name = B->getName(); @@ -617,9 +618,10 @@ ArrayRef SymbolTable::findDemangled(StringRef Name) { template std::vector -SymbolTable::findAllDemangled(const StringMatcher &M) { +SymbolTable::findAllDemangled(StringRef GlobPat) { initDemangledSyms(); std::vector Res; + StringMatcher M({GlobPat}); for (auto &P : *DemangledSyms) if (M.match(P.first())) for (SymbolBody *Body : P.second) @@ -636,7 +638,7 @@ SymbolTable::findAllDemangled(const StringMatcher &M) { template void SymbolTable::handleAnonymousVersion() { for (SymbolVersion &Ver : Config->VersionScriptGlobals) { if (hasWildcard(Ver.Name)) { - for (SymbolBody *B : findAll(StringMatcher({Ver.Name}))) + for (SymbolBody *B : findAll(Ver.Name)) B->symbol()->VersionId = VER_NDX_GLOBAL; continue; } @@ -680,9 +682,8 @@ void SymbolTable::assignWildcardVersion(SymbolVersion Ver, uint16_t VersionId) { if (!Ver.HasWildcards) return; - StringMatcher M({Ver.Name}); std::vector Syms = - Ver.IsExternCpp ? findAllDemangled(M) : findAll(M); + Ver.IsExternCpp ? findAllDemangled(Ver.Name) : findAll(Ver.Name); // Exact matching takes precendence over fuzzy matching, // so we set a version to a symbol only if no version has been assigned diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 170e184f..2bf9abc 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -92,14 +92,14 @@ public: std::vector *> Sections; private: - std::vector findAll(const StringMatcher &M); + std::vector findAll(StringRef GlobPat); std::pair insert(StringRef &Name); std::pair insert(StringRef &Name, uint8_t Type, uint8_t Visibility, bool CanOmitFromDynSym, InputFile *File); ArrayRef findDemangled(StringRef Name); - std::vector findAllDemangled(const StringMatcher &M); + std::vector findAllDemangled(StringRef GlobPat); void initDemangledSyms(); void handleAnonymousVersion(); -- 2.7.4