summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-10-08 04:19:16 +0000
committerZachary Turner <zturner@google.com>2018-10-08 04:19:16 +0000
commit94926a6db8bef54f251399408ef0c3fb722c6528 (patch)
tree7e14b6da003a95a1d9e5ab7af87d200c79eba5df /llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
parent98dd9d6896ec1ddbb8d660ad1d283345a6165339 (diff)
downloadbcm5719-llvm-94926a6db8bef54f251399408ef0c3fb722c6528.tar.gz
bcm5719-llvm-94926a6db8bef54f251399408ef0c3fb722c6528.zip
[PDB] Add the ability to lookup global symbols by name.
The Globals table is a hash table keyed on symbol name, so it's possible to lookup symbols by name in O(1) time. Add a function to the globals stream to do this, and add an option to llvm-pdbutil to exercise this, then use it to write some tests to verify correctness. llvm-svn: 343951
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
index 2e1f61c7a25..6464b85982e 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
@@ -97,6 +97,14 @@ ModuleDebugStreamRef::symbols(bool *HadError) const {
return make_range(SymbolArray.begin(HadError), SymbolArray.end());
}
+CVSymbol ModuleDebugStreamRef::readSymbolAtOffset(uint32_t Offset) const {
+ // Offsets include the size of the 4-byte magic at the beginning, but lookup
+ // doesn't take that into account, so subtract it here.
+ auto Iter = SymbolArray.at(Offset - 4);
+ assert(Iter != SymbolArray.end());
+ return *Iter;
+}
+
iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator>
ModuleDebugStreamRef::subsections() const {
return make_range(Subsections.begin(), Subsections.end());
OpenPOWER on IntegriCloud