[lld] r289065 - Inline two functions called only once. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 08:02:48 PST 2016
Author: rafael
Date: Thu Dec 8 10:02:48 2016
New Revision: 289065
URL: http://llvm.org/viewvc/llvm-project?rev=289065&view=rev
Log:
Inline two functions called only once. NFC.
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=289065&r1=289064&r2=289065&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Thu Dec 8 10:02:48 2016
@@ -585,40 +585,33 @@ void SymbolTable<ELFT>::initDemangledSym
}
template <class ELFT>
-ArrayRef<SymbolBody *> SymbolTable<ELFT>::findDemangled(StringRef Name) {
- initDemangledSyms();
- auto I = DemangledSyms->find(Name);
- if (I != DemangledSyms->end())
- return I->second;
- return {};
-}
-
-template <class ELFT>
std::vector<SymbolBody *> SymbolTable<ELFT>::find(SymbolVersion Ver) {
- if (Ver.IsExternCpp)
- return findDemangled(Ver.Name);
+ if (Ver.IsExternCpp) {
+ initDemangledSyms();
+ auto I = DemangledSyms->find(Ver.Name);
+ if (I != DemangledSyms->end())
+ return I->second;
+ return {};
+ }
std::vector<SymbolBody *> Syms;
Syms.push_back(find(Ver.Name));
return Syms;
}
template <class ELFT>
-std::vector<SymbolBody *>
-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)
- if (!Body->isUndefined())
- Res.push_back(Body);
- return Res;
-}
-
-template <class ELFT>
std::vector<SymbolBody *> SymbolTable<ELFT>::findAll(SymbolVersion Ver) {
- return Ver.IsExternCpp ? findAllDemangled(Ver.Name) : findAll(Ver.Name);
+ if (Ver.IsExternCpp) {
+ initDemangledSyms();
+ std::vector<SymbolBody *> Res;
+ StringMatcher M({Ver.Name});
+ for (auto &P : *DemangledSyms)
+ if (M.match(P.first()))
+ for (SymbolBody *Body : P.second)
+ if (!Body->isUndefined())
+ Res.push_back(Body);
+ return Res;
+ }
+ return findAll(Ver.Name);
}
// If there's only one anonymous version definition in a version
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=289065&r1=289064&r2=289065&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Thu Dec 8 10:02:48 2016
@@ -98,9 +98,7 @@ private:
uint8_t Visibility, bool CanOmitFromDynSym,
InputFile *File);
- ArrayRef<SymbolBody *> findDemangled(StringRef Name);
std::vector<SymbolBody *> find(SymbolVersion Ver);
- std::vector<SymbolBody *> findAllDemangled(StringRef GlobPat);
std::vector<SymbolBody *> findAll(SymbolVersion Ver);
void initDemangledSyms();
More information about the llvm-commits
mailing list