[lld] r287234 - Pass StringRefs instead of StringMatcher because it's simpler.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 17 08:48:54 PST 2016
Author: ruiu
Date: Thu Nov 17 10:48:53 2016
New Revision: 287234
URL: http://llvm.org/viewvc/llvm-project?rev=287234&view=rev
Log:
Pass StringRefs instead of StringMatcher because it's simpler.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=287234&r1=287233&r2=287234&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Thu Nov 17 10:48:53 2016
@@ -488,8 +488,9 @@ template <class ELFT> SymbolBody *Symbol
// Returns a list of defined symbols that match with a given pattern.
template <class ELFT>
-std::vector<SymbolBody *> SymbolTable<ELFT>::findAll(const StringMatcher &M) {
+std::vector<SymbolBody *> SymbolTable<ELFT>::findAll(StringRef GlobPat) {
std::vector<SymbolBody *> Res;
+ StringMatcher M({GlobPat});
for (Symbol *Sym : SymVector) {
SymbolBody *B = Sym->body();
StringRef Name = B->getName();
@@ -617,9 +618,10 @@ ArrayRef<SymbolBody *> SymbolTable<ELFT>
template <class ELFT>
std::vector<SymbolBody *>
-SymbolTable<ELFT>::findAllDemangled(const StringMatcher &M) {
+SymbolTable<ELFT>::findAllDemangled(StringRef GlobPat) {
initDemangledSyms();
std::vector<SymbolBody *> Res;
+ StringMatcher M({GlobPat});
for (auto &P : *DemangledSyms)
if (M.match(P.first()))
for (SymbolBody *Body : P.second)
@@ -636,7 +638,7 @@ SymbolTable<ELFT>::findAllDemangled(cons
template <class ELFT> void SymbolTable<ELFT>::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<ELFT>::assignWildcardVe
uint16_t VersionId) {
if (!Ver.HasWildcards)
return;
- StringMatcher M({Ver.Name});
std::vector<SymbolBody *> 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
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=287234&r1=287233&r2=287234&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Thu Nov 17 10:48:53 2016
@@ -92,14 +92,14 @@ public:
std::vector<InputSectionBase<ELFT> *> Sections;
private:
- std::vector<SymbolBody *> findAll(const StringMatcher &M);
+ std::vector<SymbolBody *> findAll(StringRef GlobPat);
std::pair<Symbol *, bool> insert(StringRef &Name);
std::pair<Symbol *, bool> insert(StringRef &Name, uint8_t Type,
uint8_t Visibility, bool CanOmitFromDynSym,
InputFile *File);
ArrayRef<SymbolBody *> findDemangled(StringRef Name);
- std::vector<SymbolBody *> findAllDemangled(const StringMatcher &M);
+ std::vector<SymbolBody *> findAllDemangled(StringRef GlobPat);
void initDemangledSyms();
void handleAnonymousVersion();
More information about the llvm-commits
mailing list