[llvm] r348631 - [NativePDB] Reconstruct function declarations from debug info.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 7 11:34:02 PST 2018
Author: zturner
Date: Fri Dec 7 11:34:02 2018
New Revision: 348631
URL: http://llvm.org/viewvc/llvm-project?rev=348631&view=rev
Log:
[NativePDB] Reconstruct function declarations from debug info.
Previously we would create an lldb::Function object for each function
parsed, but we would not add these to the clang AST. This is a first
step towards getting local variable support working, as we first need an
AST decl so that when we create local variable entries, they have the
proper DeclContext.
Differential Revision: https://reviews.llvm.org/D55384
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
llvm/trunk/include/llvm/Support/BinaryStreamArray.h
llvm/trunk/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h?rev=348631&r1=348630&r2=348631&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h Fri Dec 7 11:34:02 2018
@@ -50,7 +50,11 @@ inline bool symbolEndsScope(SymbolKind K
/// Given a symbol P for which symbolOpensScope(P) == true, return the
/// corresponding end offset.
-uint32_t getScopeEndOffset(const CVSymbol &symbol);
+uint32_t getScopeEndOffset(const CVSymbol &Symbol);
+
+CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+ uint32_t ScopeBegin);
+
} // namespace codeview
} // namespace llvm
Modified: llvm/trunk/include/llvm/Support/BinaryStreamArray.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamArray.h?rev=348631&r1=348630&r2=348631&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/BinaryStreamArray.h (original)
+++ llvm/trunk/include/llvm/Support/BinaryStreamArray.h Fri Dec 7 11:34:02 2018
@@ -113,6 +113,15 @@ public:
bool empty() const { return Stream.getLength() == 0; }
+ VarStreamArray<ValueType, Extractor> substream(uint32_t Begin,
+ uint32_t End) const {
+ assert(Begin >= Skew);
+ // We should never cut off the beginning of the stream since it might be
+ // skewed, meaning the initial bytes are important.
+ BinaryStreamRef NewStream = Stream.slice(0, End);
+ return {NewStream, E, Begin};
+ }
+
/// given an offset into the array's underlying stream, return an
/// iterator to the record at that offset. This is considered unsafe
/// since the behavior is undefined if \p Offset does not refer to the
Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp?rev=348631&r1=348630&r2=348631&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp Fri Dec 7 11:34:02 2018
@@ -50,4 +50,15 @@ llvm::codeview::getScopeEndOffset(const
assert(false && "Unknown record type");
return 0;
}
-}
\ No newline at end of file
+}
+
+CVSymbolArray
+llvm::codeview::limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+ uint32_t ScopeBegin) {
+ CVSymbol Opener = *Symbols.at(ScopeBegin);
+ assert(symbolOpensScope(Opener.kind()));
+ uint32_t EndOffset = getScopeEndOffset(Opener);
+ CVSymbol Closer = *Symbols.at(EndOffset);
+ EndOffset += Closer.RecordData.size();
+ return Symbols.substream(ScopeBegin, EndOffset);
+}
More information about the llvm-commits
mailing list