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/PDBSymbolCompiland.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/PDBSymbolCompiland.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp index f014b39..0c9b190 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolCompiland.cpp @@ -9,18 +9,9 @@ #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" -#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" -#include "llvm/DebugInfo/PDB/IPDBSession.h" -#include "llvm/DebugInfo/PDB/IPDBSourceFile.h" -#include "llvm/DebugInfo/PDB/PDBExtras.h" -#include "llvm/DebugInfo/PDB/PDBSymbol.h" -#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h" -#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/DebugInfo/PDB/PDBSymDumper.h" #include <utility> -#include <vector> using namespace llvm; @@ -28,45 +19,7 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol) : PDBSymbol(PDBSession, std::move(Symbol)) {} -#define SKIP_SYMBOL_IF_FLAG_UNSET(Tag, Flag) \ - case PDB_SymType::Tag: \ - if ((Flags & Flag) == 0) \ - continue; \ - break; - void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent, - PDB_DumpLevel Level, PDB_DumpFlags Flags) const { - if (Level == PDB_DumpLevel::Detailed) { - std::string FullName = getName(); - OS << stream_indent(Indent) << FullName; - if (Flags & PDB_DF_Children) { - if (Level >= PDB_DumpLevel::Detailed) { - auto ChildrenEnum = findAllChildren(); - while (auto Child = ChildrenEnum->getNext()) { - switch (Child->getSymTag()) { - SKIP_SYMBOL_IF_FLAG_UNSET(Function, PDB_DF_Functions) - SKIP_SYMBOL_IF_FLAG_UNSET(Data, PDB_DF_Data) - SKIP_SYMBOL_IF_FLAG_UNSET(Label, PDB_DF_Labels) - SKIP_SYMBOL_IF_FLAG_UNSET(PublicSymbol, PDB_DF_PublicSyms) - SKIP_SYMBOL_IF_FLAG_UNSET(UDT, PDB_DF_Classes) - SKIP_SYMBOL_IF_FLAG_UNSET(Enum, PDB_DF_Enums) - SKIP_SYMBOL_IF_FLAG_UNSET(FunctionSig, PDB_DF_Funcsigs) - SKIP_SYMBOL_IF_FLAG_UNSET(VTable, PDB_DF_VTables) - SKIP_SYMBOL_IF_FLAG_UNSET(Thunk, PDB_DF_Thunks) - SKIP_SYMBOL_IF_FLAG_UNSET(Compiland, PDB_DF_ObjFiles) - default: - continue; - } - PDB_DumpLevel ChildLevel = (Level == PDB_DumpLevel::Detailed) - ? PDB_DumpLevel::Normal - : PDB_DumpLevel::Compact; - OS << "\n"; - Child->dump(OS, Indent + 2, ChildLevel, PDB_DF_Children); - } - } - } - } else { - std::string FullName = getName(); - OS << stream_indent(Indent) << "Compiland: " << FullName; - } + PDBSymDumper &Dumper) const { + Dumper.dump(*this, OS, Indent); } |