diff options
author | Zachary Turner <zturner@google.com> | 2017-06-01 21:52:41 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-01 21:52:41 +0000 |
commit | ebd3ae8371b4ca7b4c9c0bd62f28babaaf25a633 (patch) | |
tree | 17fdc737dd47911abd76029d670ff96b10860285 /llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp | |
parent | 678aa336fa8d0cfac176d3bd95ddb96f545bbe68 (diff) | |
download | bcm5719-llvm-ebd3ae8371b4ca7b4c9c0bd62f28babaaf25a633.tar.gz bcm5719-llvm-ebd3ae8371b4ca7b4c9c0bd62f28babaaf25a633.zip |
[CodeView] Properly align symbol records on read/write.
Object files have symbol records not aligned to any particular
boundary (e.g. 1-byte aligned), while PDB files have symbol
records padded to 4-byte aligned boundaries. Since they share
the same reading / writing code, we have to provide an option to
specify the alignment and propagate it up to the producer or
consumer who knows what the alignment is supposed to be for the
given container type.
Added a test for this by modifying the existing PDB -> YAML -> PDB
round-tripping code to round trip symbol records as well as types.
Differential Revision: https://reviews.llvm.org/D33785
llvm-svn: 304484
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp b/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp index 251cc431f52..9f2d619d1a1 100644 --- a/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp +++ b/llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp @@ -12,9 +12,11 @@ using namespace llvm; using namespace llvm::codeview; -SymbolSerializer::SymbolSerializer(BumpPtrAllocator &Allocator) - : Storage(Allocator), RecordBuffer(MaxRecordLength), Stream(RecordBuffer, llvm::support::little), - Writer(Stream), Mapping(Writer) { } +SymbolSerializer::SymbolSerializer(BumpPtrAllocator &Allocator, + CodeViewContainer Container) + : Storage(Allocator), RecordBuffer(MaxRecordLength), + Stream(RecordBuffer, llvm::support::little), Writer(Stream), + Mapping(Writer, Container) {} Error SymbolSerializer::visitSymbolBegin(CVSymbol &Record) { assert(!CurrentSymbol.hasValue() && "Already in a symbol mapping!"); |