summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-12-17 16:15:36 +0000
committerZachary Turner <zturner@google.com>2018-12-17 16:15:36 +0000
commitbb3d7e565f9b14559057403e772bc8b26f636534 (patch)
treedbec4244e4c4201b269dda370dc1f47e76ef4e1d /llvm/lib
parent1639c6bbb186c733ffb4f54c9f77522f262fe2ba (diff)
downloadbcm5719-llvm-bb3d7e565f9b14559057403e772bc8b26f636534.tar.gz
bcm5719-llvm-bb3d7e565f9b14559057403e772bc8b26f636534.zip
[PDB] Add some helper functions for working with scopes.
llvm-svn: 349361
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp34
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp7
2 files changed, 39 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp b/llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
index 79f39591929..01746138ad1 100644
--- a/llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
+++ b/llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
@@ -21,8 +21,7 @@ template <typename RecordT> RecordT createRecord(const CVSymbol &sym) {
return record;
}
-uint32_t
-llvm::codeview::getScopeEndOffset(const llvm::codeview::CVSymbol &Sym) {
+uint32_t llvm::codeview::getScopeEndOffset(const CVSymbol &Sym) {
assert(symbolOpensScope(Sym.kind()));
switch (Sym.kind()) {
case SymbolKind::S_GPROC32:
@@ -52,6 +51,37 @@ llvm::codeview::getScopeEndOffset(const llvm::codeview::CVSymbol &Sym) {
}
}
+uint32_t
+llvm::codeview::getScopeParentOffset(const llvm::codeview::CVSymbol &Sym) {
+ assert(symbolOpensScope(Sym.kind()));
+ switch (Sym.kind()) {
+ case SymbolKind::S_GPROC32:
+ case SymbolKind::S_LPROC32:
+ case SymbolKind::S_GPROC32_ID:
+ case SymbolKind::S_LPROC32_ID:
+ case SymbolKind::S_LPROC32_DPC:
+ case SymbolKind::S_LPROC32_DPC_ID: {
+ ProcSym Proc = createRecord<ProcSym>(Sym);
+ return Proc.Parent;
+ }
+ case SymbolKind::S_BLOCK32: {
+ BlockSym Block = createRecord<BlockSym>(Sym);
+ return Block.Parent;
+ }
+ case SymbolKind::S_THUNK32: {
+ Thunk32Sym Thunk = createRecord<Thunk32Sym>(Sym);
+ return Thunk.Parent;
+ }
+ case SymbolKind::S_INLINESITE: {
+ InlineSiteSym Site = createRecord<InlineSiteSym>(Sym);
+ return Site.Parent;
+ }
+ default:
+ assert(false && "Unknown record type");
+ return 0;
+ }
+}
+
CVSymbolArray
llvm::codeview::limitSymbolArrayToScope(const CVSymbolArray &Symbols,
uint32_t ScopeBegin) {
diff --git a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
index 5ff7c1574dd..8c97f4a012f 100644
--- a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
@@ -11,7 +11,9 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
+#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryStreamReader.h"
@@ -77,6 +79,11 @@ Error ModuleDebugStreamRef::reload() {
return Error::success();
}
+const codeview::CVSymbolArray
+ModuleDebugStreamRef::getSymbolArrayForScope(uint32_t ScopeBegin) const {
+ return limitSymbolArrayToScope(SymbolArray, ScopeBegin);
+}
+
BinarySubstreamRef ModuleDebugStreamRef::getSymbolsSubstream() const {
return SymbolsSubstream;
}
OpenPOWER on IntegriCloud