llvm-pdbdump: Add flags controlling the type of values to dump.
[oota-llvm.git] / lib / DebugInfo / PDB / PDBSymbolTypeUDT.cpp
index 32b003c5216a69dba22f63571053f07c872029c2..ea884bdac516f1d567efee211ef7bfba87688f17 100644 (file)
@@ -7,15 +7,36 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <utility>
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
 
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+
+#include <utility>
 
 using namespace llvm;
 
-PDBSymbolTypeUDT::PDBSymbolTypeUDT(IPDBSession &PDBSession,
+PDBSymbolTypeUDT::PDBSymbolTypeUDT(const IPDBSession &PDBSession,
                                    std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeUDT::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeUDT::dump(raw_ostream &OS, int Indent,
+                            PDB_DumpLevel Level, PDB_DumpFlags Flags) const {
+  OS << stream_indent(Indent);
+  if (Level >= PDB_DumpLevel::Normal)
+    OS << "class ";
+
+  if (isNested()) {
+    uint32_t ClassId = getClassParentId();
+    if (ClassId != 0) {
+      if (auto ClassParent = Session.getSymbolById(ClassId)) {
+        ClassParent->dump(OS, 0, Level, PDB_DF_Children);
+        OS << "::";
+      }
+    }
+  }
+  OS << getName();
+
+  if (Level >= PDB_DumpLevel::Normal)
+    OS << " (" << getLength() << " bytes)";
+}