Avoid duplicate search by reusing the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Yaron Keren 2013-10-19 09:04:26 +00:00
parent f14bb8f5e6
commit 4805bf59b9
2 changed files with 7 additions and 5 deletions

View File

@ -503,7 +503,7 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
} else {
// We found the symbol in our global table. It was probably in a
// Module that we loaded previously.
SymbolLoc SymLoc = GlobalSymbolTable.lookup(Name);
SymbolLoc SymLoc = Loc->second;
Addr = getSectionLoadAddress(SymLoc.first) + SymLoc.second;
}

View File

@ -308,18 +308,20 @@ public:
void *getSymbolAddress(StringRef Name) {
// FIXME: Just look up as a function for now. Overly simple of course.
// Work in progress.
if (GlobalSymbolTable.find(Name) == GlobalSymbolTable.end())
SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
if (pos == GlobalSymbolTable.end())
return 0;
SymbolLoc Loc = GlobalSymbolTable.lookup(Name);
SymbolLoc Loc = pos->second;
return getSectionAddress(Loc.first) + Loc.second;
}
uint64_t getSymbolLoadAddress(StringRef Name) {
// FIXME: Just look up as a function for now. Overly simple of course.
// Work in progress.
if (GlobalSymbolTable.find(Name) == GlobalSymbolTable.end())
SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
if (pos == GlobalSymbolTable.end())
return 0;
SymbolLoc Loc = GlobalSymbolTable.lookup(Name);
SymbolLoc Loc = pos->second;
return getSectionLoadAddress(Loc.first) + Loc.second;
}