diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2013-10-19 09:04:26 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2013-10-19 09:04:26 +0000 |
commit | 4805bf59b9e41a95336c066ec58194ff6801694a (patch) | |
tree | f6bddbf2ba2e1e1bb698e2c49549b12ff390572c /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | |
parent | f14bb8f5e664cda4cd720d638ad99cc635531442 (diff) | |
download | llvm-4805bf59b9e41a95336c066ec58194ff6801694a.tar.gz llvm-4805bf59b9e41a95336c066ec58194ff6801694a.tar.bz2 llvm-4805bf59b9e41a95336c066ec58194ff6801694a.tar.xz |
Avoid duplicate search by reusing the iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193034 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index 0628fa7180..465d05bf2c 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -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; } |