diff options
author | Zachary Turner <zturner@google.com> | 2015-02-22 22:03:38 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-02-22 22:03:38 +0000 |
commit | 9a818ad193d19ef2f560e6da4b0fcf6748979fdb (patch) | |
tree | dc22e1c7f49c2326e9ec39be74c601925dc9b133 /llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp | |
parent | 87f4c90a5c0b38d497e975e8e2c54bbd6f4050a5 (diff) | |
download | llvm-9a818ad193d19ef2f560e6da4b0fcf6748979fdb.zip llvm-9a818ad193d19ef2f560e6da4b0fcf6748979fdb.tar.gz llvm-9a818ad193d19ef2f560e6da4b0fcf6748979fdb.tar.bz2 |
[llvm-pdbdump] Rewrite dumper using visitor pattern.
This increases the flexibility of how to dump different
symbol types -- necessary for context-sensitive formatting of
symbol types -- and also improves the modularity by allowing
the dumping to be implemented in the actual dumper, as opposed
to in the PDB library.
llvm-svn: 230184
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp index 9a04ecd..09b96bc 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolData.cpp @@ -9,11 +9,7 @@ #include "llvm/DebugInfo/PDB/PDBSymbolData.h" -#include "llvm/DebugInfo/PDB/IPDBSession.h" -#include "llvm/DebugInfo/PDB/PDBExtras.h" -#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" -#include "llvm/Support/Format.h" -#include <utility> +#include "llvm/DebugInfo/PDB/PDBSymDumper.h" #include <utility> @@ -24,68 +20,6 @@ PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession, : PDBSymbol(PDBSession, std::move(DataSymbol)) {} void PDBSymbolData::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level, PDB_DumpFlags Flags) const { - OS << stream_indent(Indent); - PDB_LocType Loc = getLocationType(); - PDB_DataKind Kind = getDataKind(); - switch (Loc) { - case PDB_LocType::Static: { - uint32_t RVA = getRelativeVirtualAddress(); - OS << Kind << " data["; - if (RVA != 0) - OS << format_hex(RVA, 10); - else - OS << "???"; - break; - } - case PDB_LocType::TLS: - OS << "threadlocal " << Kind << " data["; - OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10); - break; - case PDB_LocType::RegRel: - OS << "regrel " << Kind << " data["; - OS << getRegisterId() << " + " << getOffset(); - break; - case PDB_LocType::ThisRel: { - uint32_t Offset = getOffset(); - OS << Kind << " data[this + " << format_hex(Offset, 4); - break; - } - case PDB_LocType::Enregistered: - OS << "register " << Kind << " data[" << getRegisterId(); - break; - case PDB_LocType::BitField: { - OS << "bitfield data[this + "; - uint32_t Offset = getOffset(); - uint32_t BitPos = getBitPosition(); - uint32_t Length = getLength(); - OS << format_hex(Offset, 4) << ":" << BitPos << "," << Length; - break; - } - case PDB_LocType::Slot: - OS << getSlot(); - break; - case PDB_LocType::Constant: { - OS << "constant data["; - OS << getValue(); - break; - } - case PDB_LocType::IlRel: - case PDB_LocType::MetaData: - default: - OS << "???"; - } - - OS << "] "; - if (Kind == PDB_DataKind::Member || Kind == PDB_DataKind::StaticMember) { - uint32_t ClassId = getClassParentId(); - if (auto Class = Session.getSymbolById(ClassId)) { - if (auto UDT = dyn_cast<PDBSymbolTypeUDT>(Class.get())) - OS << UDT->getName(); - else - OS << "{class " << Class->getSymTag() << "}"; - OS << "::"; - } - } - OS << getName(); + PDBSymDumper &Dumper) const { + Dumper.dump(*this, OS, Indent); }
\ No newline at end of file |