diff options
author | Zachary Turner <zturner@google.com> | 2017-04-29 01:13:21 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-04-29 01:13:21 +0000 |
commit | 5b6e4e0aed43017079f854d9909e2c8a0e4e1a07 (patch) | |
tree | 9784242c8790de5e617fb6c27240f13cb18d8b91 /llvm/lib | |
parent | c7cacdc3327de057bfa25d2195cce1f8146e8769 (diff) | |
download | bcm5719-llvm-5b6e4e0aed43017079f854d9909e2c8a0e4e1a07.tar.gz bcm5719-llvm-5b6e4e0aed43017079f854d9909e2c8a0e4e1a07.zip |
[llvm-pdbdump] Abstract some of the YAML/Raw printing code.
There is a lot of duplicate code for printing line info between
YAML and the raw output printer. This introduces a base class
that can be shared between the two, and makes some minor
cleanups in the process.
llvm-svn: 301728
Diffstat (limited to 'llvm/lib')
6 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp b/llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp index 53dc922a649..ce1d8d918b2 100644 --- a/llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp @@ -10,7 +10,9 @@ #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h" #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h" #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h" #include "llvm/Support/BinaryStreamReader.h" #include "llvm/Support/BinaryStreamRef.h" diff --git a/llvm/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp b/llvm/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp index 1b840890560..d25be2d02d8 100644 --- a/llvm/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp +++ b/llvm/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp @@ -1,5 +1,4 @@ -//===- ModuleDebugLineFragment.cpp --------------------------------*- C++ -//-*-===// +//===- ModuleDebugLineFragment.cpp -------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -24,7 +23,7 @@ Error LineColumnExtractor::extract(BinaryStreamRef Stream, uint32_t &Len, BinaryStreamReader Reader(Stream); if (auto EC = Reader.readObject(BlockHeader)) return EC; - bool HasColumn = Header->Flags & uint32_t(LineFlags::HaveColumns); + bool HasColumn = Header->Flags & uint16_t(LF_HaveColumns); uint32_t LineInfoSize = BlockHeader->NumLines * (sizeof(LineNumberEntry) + (HasColumn ? sizeof(ColumnNumberEntry) : 0)); @@ -61,3 +60,7 @@ Error ModuleDebugLineFragment::initialize(BinaryStreamReader Reader) { return Error::success(); } + +bool ModuleDebugLineFragment::hasColumnInfo() const { + return Header->Flags & LF_HaveColumns; +} diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp index e04388be7f3..dabcc3447ee 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp @@ -57,8 +57,8 @@ uint32_t DbiModuleDescriptor::getSymbolDebugInfoByteSize() const { return Layout->SymBytes; } -uint32_t DbiModuleDescriptor::getLineInfoByteSize() const { - return Layout->LineBytes; +uint32_t DbiModuleDescriptor::getC11LineInfoByteSize() const { + return Layout->C11Bytes; } uint32_t DbiModuleDescriptor::getC13LineInfoByteSize() const { diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp index 91b07110362..8920dd9bbea 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp @@ -77,10 +77,10 @@ uint32_t DbiModuleDescriptorBuilder::calculateSerializedLength() const { } void DbiModuleDescriptorBuilder::finalize() { - Layout.C13Bytes = 0; Layout.FileNameOffs = 0; // TODO: Fix this Layout.Flags = 0; // TODO: Fix this - Layout.LineBytes = 0; + Layout.C11Bytes = 0; + Layout.C13Bytes = 0; (void)Layout.Mod; // Set in constructor (void)Layout.ModDiStream; // Set in finalizeMsfLayout Layout.NumFiles = SourceFiles.size(); diff --git a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp index e5eb01d5f52..5e719c6179a 100644 --- a/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp @@ -35,7 +35,7 @@ Error ModuleDebugStream::reload() { BinaryStreamReader Reader(*Stream); uint32_t SymbolSize = Mod.getSymbolDebugInfoByteSize(); - uint32_t C11Size = Mod.getLineInfoByteSize(); + uint32_t C11Size = Mod.getC11LineInfoByteSize(); uint32_t C13Size = Mod.getC13LineInfoByteSize(); if (C11Size > 0 && C13Size > 0) diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index 3bc074407a8..2b97ecc0fd2 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -208,7 +208,7 @@ void CodeViewContext::emitLineTableForFunction(MCObjectStreamer &OS, bool HaveColumns = any_of(Locs, [](const MCCVLineEntry &LineEntry) { return LineEntry.getColumn() != 0; }); - OS.EmitIntValue(HaveColumns ? int(LineFlags::HaveColumns) : 0, 2); + OS.EmitIntValue(HaveColumns ? int(LF_HaveColumns) : 0, 2); OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 4); for (auto I = Locs.begin(), E = Locs.end(); I != E;) { |