[lld] r319113 - Rename `Symtab` private memory to avoid confusion with global `Symtab`
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 15:16:06 PST 2017
Author: sbc
Date: Mon Nov 27 15:16:06 2017
New Revision: 319113
URL: http://llvm.org/viewvc/llvm-project?rev=319113&view=rev
Log:
Rename `Symtab` private memory to avoid confusion with global `Symtab`
This is also consistent with SymVector that exists in COFF port
and soon to be added to the wasm port.
Split off as part of https://reviews.llvm.org/D40371
Differential Revision: https://reviews.llvm.org/D40525
Modified:
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/SymbolTable.h
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/wasm/SymbolTable.cpp
lld/trunk/wasm/SymbolTable.h
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Mon Nov 27 15:16:06 2017
@@ -94,7 +94,7 @@ static void errorOrWarn(const Twine &S)
void SymbolTable::reportRemainingUndefines() {
SmallPtrSet<Symbol *, 8> Undefs;
- for (auto &I : Symtab) {
+ for (auto &I : SymMap) {
Symbol *Sym = I.second;
auto *Undef = dyn_cast<Undefined>(Sym);
if (!Undef)
@@ -153,7 +153,7 @@ void SymbolTable::reportRemainingUndefin
}
std::pair<Symbol *, bool> SymbolTable::insert(StringRef Name) {
- Symbol *&Sym = Symtab[CachedHashStringRef(Name)];
+ Symbol *&Sym = SymMap[CachedHashStringRef(Name)];
if (Sym)
return {Sym, false};
Sym = (Symbol *)make<SymbolUnion>();
@@ -318,8 +318,8 @@ std::vector<Chunk *> SymbolTable::getChu
}
Symbol *SymbolTable::find(StringRef Name) {
- auto It = Symtab.find(CachedHashStringRef(Name));
- if (It == Symtab.end())
+ auto It = SymMap.find(CachedHashStringRef(Name));
+ if (It == SymMap.end())
return nullptr;
return It->second;
}
@@ -331,7 +331,7 @@ Symbol *SymbolTable::findUnderscore(Stri
}
StringRef SymbolTable::findByPrefix(StringRef Prefix) {
- for (auto Pair : Symtab) {
+ for (auto Pair : SymMap) {
StringRef Name = Pair.first.val();
if (Name.startswith(Prefix))
return Name;
Modified: lld/trunk/COFF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.h (original)
+++ lld/trunk/COFF/SymbolTable.h Mon Nov 27 15:16:06 2017
@@ -100,7 +100,7 @@ public:
// Iterates symbols in non-determinstic hash table order.
template <typename T> void forEachSymbol(T Callback) {
- for (auto &Pair : Symtab)
+ for (auto &Pair : SymMap)
Callback(Pair.second);
}
@@ -108,7 +108,7 @@ private:
std::pair<Symbol *, bool> insert(StringRef Name);
StringRef findByPrefix(StringRef Prefix);
- llvm::DenseMap<llvm::CachedHashStringRef, Symbol *> Symtab;
+ llvm::DenseMap<llvm::CachedHashStringRef, Symbol *> SymMap;
std::unique_ptr<BitcodeCompiler> LTO;
};
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Mon Nov 27 15:16:06 2017
@@ -145,7 +145,7 @@ Defined *SymbolTable::addAbsolute(String
// Set a flag for --trace-symbol so that we can print out a log message
// if a new symbol with the same name is inserted into the symbol table.
void SymbolTable::trace(StringRef Name) {
- Symtab.insert({CachedHashStringRef(Name), -1});
+ SymMap.insert({CachedHashStringRef(Name), -1});
}
// Rename SYM as __wrap_SYM. The original symbol is preserved as __real_SYM.
@@ -222,7 +222,7 @@ std::pair<Symbol *, bool> SymbolTable::i
if (Pos != StringRef::npos && Pos + 1 < Name.size() && Name[Pos + 1] == '@')
Name = Name.take_front(Pos);
- auto P = Symtab.insert({CachedHashStringRef(Name), (int)SymVector.size()});
+ auto P = SymMap.insert({CachedHashStringRef(Name), (int)SymVector.size()});
int &SymIndex = P.first->second;
bool IsNew = P.second;
bool Traced = false;
@@ -524,8 +524,8 @@ Symbol *SymbolTable::addBitcode(StringRe
}
Symbol *SymbolTable::find(StringRef Name) {
- auto It = Symtab.find(CachedHashStringRef(Name));
- if (It == Symtab.end())
+ auto It = SymMap.find(CachedHashStringRef(Name));
+ if (It == SymMap.end())
return nullptr;
if (It->second == -1)
return nullptr;
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Mon Nov 27 15:16:06 2017
@@ -105,7 +105,7 @@ private:
// but a bit inefficient.
// FIXME: Experiment with passing in a custom hashing or sorting the symbols
// once symbol resolution is finished.
- llvm::DenseMap<llvm::CachedHashStringRef, int> Symtab;
+ llvm::DenseMap<llvm::CachedHashStringRef, int> SymMap;
std::vector<Symbol *> SymVector;
// Comdat groups define "link once" sections. If two comdat groups have the
Modified: lld/trunk/wasm/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SymbolTable.cpp?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/wasm/SymbolTable.cpp (original)
+++ lld/trunk/wasm/SymbolTable.cpp Mon Nov 27 15:16:06 2017
@@ -34,7 +34,7 @@ void SymbolTable::addFile(InputFile *Fil
void SymbolTable::reportRemainingUndefines() {
std::unordered_set<Symbol *> Undefs;
- for (auto &I : Symtab) {
+ for (auto &I : SymMap) {
Symbol *Sym = I.second;
if (Sym->isUndefined() && !Sym->isWeak() &&
Config->AllowUndefinedSymbols.count(Sym->getName()) == 0) {
@@ -56,14 +56,14 @@ void SymbolTable::reportRemainingUndefin
}
Symbol *SymbolTable::find(StringRef Name) {
- auto It = Symtab.find(CachedHashStringRef(Name));
- if (It == Symtab.end())
+ auto It = SymMap.find(CachedHashStringRef(Name));
+ if (It == SymMap.end())
return nullptr;
return It->second;
}
std::pair<Symbol *, bool> SymbolTable::insert(StringRef Name) {
- Symbol *&Sym = Symtab[CachedHashStringRef(Name)];
+ Symbol *&Sym = SymMap[CachedHashStringRef(Name)];
if (Sym)
return {Sym, false};
Sym = make<Symbol>(Name, false);
Modified: lld/trunk/wasm/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SymbolTable.h?rev=319113&r1=319112&r2=319113&view=diff
==============================================================================
--- lld/trunk/wasm/SymbolTable.h (original)
+++ lld/trunk/wasm/SymbolTable.h Mon Nov 27 15:16:06 2017
@@ -58,7 +58,7 @@ public:
private:
std::pair<Symbol *, bool> insert(StringRef Name);
- llvm::DenseMap<llvm::CachedHashStringRef, Symbol *> Symtab;
+ llvm::DenseMap<llvm::CachedHashStringRef, Symbol *> SymMap;
};
extern SymbolTable *Symtab;
More information about the llvm-commits
mailing list