[lld] r275746 - Iterate over SymVector instead of Symtab hash table.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 17 18:34:57 PDT 2016
Author: ruiu
Date: Sun Jul 17 20:34:57 2016
New Revision: 275746
URL: http://llvm.org/viewvc/llvm-project?rev=275746&view=rev
Log:
Iterate over SymVector instead of Symtab hash table.
SymVector contains all symbols, so we can iterate either Symtab or SymVector
to visit all symbols. Iterating over SymVector makes the next change for
--trace-symbol possible.
Modified:
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=275746&r1=275745&r2=275746&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sun Jul 17 20:34:57 2016
@@ -456,10 +456,9 @@ template <class ELFT> SymbolBody *Symbol
template <class ELFT>
std::vector<SymbolBody *> SymbolTable<ELFT>::findAll(StringRef Pattern) {
std::vector<SymbolBody *> Res;
- for (auto &It : Symtab) {
- StringRef Name = It.first.Val;
- SymbolBody *B = SymVector[It.second]->body();
- if (!B->isUndefined() && globMatch(Pattern, Name))
+ for (Symbol *Sym : SymVector) {
+ SymbolBody *B = Sym->body();
+ if (!B->isUndefined() && globMatch(Pattern, B->getName()))
Res.push_back(B);
}
return Res;
@@ -569,8 +568,10 @@ static void setVersionId(SymbolBody *Bod
template <class ELFT>
std::map<std::string, SymbolBody *> SymbolTable<ELFT>::getDemangledSyms() {
std::map<std::string, SymbolBody *> Result;
- for (std::pair<SymName, unsigned> Sym : Symtab)
- Result[demangle(Sym.first.Val)] = SymVector[Sym.second]->body();
+ for (Symbol *Sym : SymVector) {
+ SymbolBody *B = Sym->body();
+ Result[demangle(B->getName())] = B;
+ }
return Result;
}
More information about the llvm-commits
mailing list