summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-01 21:52:41 +0000
committerZachary Turner <zturner@google.com>2017-06-01 21:52:41 +0000
commitebd3ae8371b4ca7b4c9c0bd62f28babaaf25a633 (patch)
tree17fdc737dd47911abd76029d670ff96b10860285 /llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
parent678aa336fa8d0cfac176d3bd95ddb96f545bbe68 (diff)
downloadbcm5719-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/ObjectYAML/CodeViewYAMLSymbols.cpp')
-rw-r--r--llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
index 6e8bb5c7372..bd97af3a932 100644
--- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
+++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
@@ -148,7 +148,8 @@ struct SymbolRecordBase {
virtual ~SymbolRecordBase() {}
virtual void map(yaml::IO &io) = 0;
virtual codeview::CVSymbol
- toCodeViewSymbol(BumpPtrAllocator &Allocator) const = 0;
+ toCodeViewSymbol(BumpPtrAllocator &Allocator,
+ CodeViewContainer Container) const = 0;
virtual Error fromCodeViewSymbol(codeview::CVSymbol Type) = 0;
};
@@ -159,8 +160,9 @@ template <typename T> struct SymbolRecordImpl : public SymbolRecordBase {
void map(yaml::IO &io) override;
codeview::CVSymbol
- toCodeViewSymbol(BumpPtrAllocator &Allocator) const override {
- return SymbolSerializer::writeOneSymbol(Symbol, Allocator);
+ toCodeViewSymbol(BumpPtrAllocator &Allocator,
+ CodeViewContainer Container) const override {
+ return SymbolSerializer::writeOneSymbol(Symbol, Allocator, Container);
}
Error fromCodeViewSymbol(codeview::CVSymbol CVS) override {
return SymbolDeserializer::deserializeAs<T>(CVS, Symbol);
@@ -429,8 +431,8 @@ template <> void SymbolRecordImpl<ThreadLocalDataSym>::map(IO &IO) {
}
CVSymbol CodeViewYAML::SymbolRecord::toCodeViewSymbol(
- BumpPtrAllocator &Allocator) const {
- return Symbol->toCodeViewSymbol(Allocator);
+ BumpPtrAllocator &Allocator, CodeViewContainer Container) const {
+ return Symbol->toCodeViewSymbol(Allocator, Container);
}
namespace llvm {
OpenPOWER on IntegriCloud