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.

llvm-svn: 275746
This commit is contained in:
Rui Ueyama 2016-07-18 01:34:57 +00:00
parent 03e29a2964
commit d6328526ba
1 changed files with 7 additions and 6 deletions

View File

@ -456,10 +456,9 @@ template <class ELFT> SymbolBody *SymbolTable<ELFT>::find(StringRef Name) {
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 *Body, StringRef VersionName,
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;
}