[llvm] r343507 - [PDB] Add support for dumping Typedef records.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 10:55:38 PDT 2018


Author: zturner
Date: Mon Oct  1 10:55:38 2018
New Revision: 343507

URL: http://llvm.org/viewvc/llvm-project?rev=343507&view=rev
Log:
[PDB] Add support for dumping Typedef records.

These work a little differently because they are actually in
the globals stream and are treated as symbol records, even though
DIA presents them as types.  So this also adds the necessary
infrastructure to cache records that live somewhere other than
the TPI stream as well.

Added:
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
    llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
    llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp
    llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-typedefs.test
Modified:
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/SymbolCache.h
    llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
    llvm/trunk/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
    llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
    llvm/trunk/test/tools/llvm-pdbdump/type-qualifiers.test
    llvm/trunk/tools/llvm-pdbutil/PrettyTypedefDumper.cpp
    llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp

Added: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h?rev=343507&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h Mon Oct  1 10:55:38 2018
@@ -0,0 +1,43 @@
+//==- NativeEnumGlobals.h - Native Global Enumerator impl --------*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMGLOBALS_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMGLOBALS_H
+
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+
+#include <vector>
+
+namespace llvm {
+namespace pdb {
+
+class NativeSession;
+
+class NativeEnumGlobals : public IPDBEnumChildren<PDBSymbol> {
+public:
+  NativeEnumGlobals(NativeSession &Session,
+                    std::vector<codeview::SymbolKind> Kinds);
+
+  uint32_t getChildCount() const override;
+  std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override;
+  std::unique_ptr<PDBSymbol> getNext() override;
+  void reset() override;
+
+private:
+  std::vector<uint32_t> MatchOffsets;
+  uint32_t Index;
+  NativeSession &Session;
+};
+
+} // namespace pdb
+} // namespace llvm
+
+#endif

Added: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h?rev=343507&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h Mon Oct  1 10:55:38 2018
@@ -0,0 +1,42 @@
+//===- NativeTypeTypedef.h - info about typedef ------------------*- C++-*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPETYPEDEF_H
+#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPETYPEDEF_H
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
+#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+
+namespace llvm {
+namespace pdb {
+
+class NativeTypeTypedef : public NativeRawSymbol {
+public:
+  // Create a pointer record for a non-simple type.
+  NativeTypeTypedef(NativeSession &Session, SymIndexId Id,
+                    codeview::UDTSym Typedef);
+
+  ~NativeTypeTypedef() override;
+
+  void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+            PdbSymbolIdField RecurseIdFields) const override;
+
+  std::string getName() const override;
+  SymIndexId getTypeId() const override;
+
+protected:
+  codeview::UDTSym Record;
+};
+
+} // namespace pdb
+} // namespace llvm
+
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
\ No newline at end of file

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h Mon Oct  1 10:55:38 2018
@@ -43,4 +43,4 @@ protected:
 } // namespace pdb
 } // namespace llvm
 
-#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
\ No newline at end of file
+#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEVTSHAPE_H
\ No newline at end of file

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/SymbolCache.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/SymbolCache.h?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/SymbolCache.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/SymbolCache.h Mon Oct  1 10:55:38 2018
@@ -29,12 +29,30 @@ class SymbolCache {
   NativeSession &Session;
   DbiStream *Dbi = nullptr;
 
+  /// Cache of all stable symbols, indexed by SymIndexId.  Just because a
+  /// symbol has been parsed does not imply that it will be stable and have
+  /// an Id.  Id allocation is an implementation, with the only guarantee
+  /// being that once an Id is allocated, the symbol can be assumed to be
+  /// cached.
   std::vector<std::unique_ptr<NativeRawSymbol>> Cache;
+
+  /// For type records from the TPI stream which have been paresd and cached,
+  /// stores a mapping to SymIndexId of the cached symbol.
   DenseMap<codeview::TypeIndex, SymIndexId> TypeIndexToSymbolId;
+
+  /// For field list members which have been parsed and cached, stores a mapping
+  /// from (IndexOfClass, MemberIndex) to the corresponding SymIndexId of the
+  /// cached symbol.
   DenseMap<std::pair<codeview::TypeIndex, uint32_t>, SymIndexId>
       FieldListMembersToSymbolId;
+
+  /// List of SymIndexIds for each compiland, indexed by compiland index as they
+  /// appear in the PDB file.
   std::vector<SymIndexId> Compilands;
 
+  /// Map from global symbol offset to SymIndexId.
+  DenseMap<uint32_t, SymIndexId> GlobalOffsetToSymbolId;
+
   SymIndexId createSymbolPlaceholder() {
     SymIndexId Id = Cache.size();
     Cache.push_back(nullptr);
@@ -89,6 +107,9 @@ public:
   std::unique_ptr<IPDBEnumSymbols>
   createTypeEnumerator(std::vector<codeview::TypeLeafKind> Kinds);
 
+  std::unique_ptr<IPDBEnumSymbols>
+  createGlobalsEnumerator(codeview::SymbolKind Kind);
+
   SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI);
 
   template <typename ConcreteSymbolT, typename... Args>
@@ -106,6 +127,8 @@ public:
     return SymId;
   }
 
+  SymIndexId getOrCreateGlobalSymbolByOffset(uint32_t Offset);
+
   std::unique_ptr<PDBSymbolCompiland> getOrCreateCompiland(uint32_t Index);
   uint32_t getNumCompilands() const;
 

Modified: llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt Mon Oct  1 10:55:38 2018
@@ -47,6 +47,7 @@ add_pdb_impl_folder(Native
   Native/InfoStreamBuilder.cpp
   Native/ModuleDebugStream.cpp
   Native/NativeCompilandSymbol.cpp
+  Native/NativeEnumGlobals.cpp
   Native/NativeEnumModules.cpp
   Native/NativeEnumTypes.cpp
   Native/NativeExeSymbol.cpp
@@ -57,6 +58,7 @@ add_pdb_impl_folder(Native
   Native/NativeTypeEnum.cpp
   Native/NativeTypeFunctionSig.cpp
   Native/NativeTypePointer.cpp
+  Native/NativeTypeTypedef.cpp
   Native/NativeTypeUDT.cpp
   Native/NativeTypeVTShape.cpp
   Native/NamedStreamMap.cpp

Added: llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp?rev=343507&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeEnumGlobals.cpp Mon Oct  1 10:55:38 2018
@@ -0,0 +1,55 @@
+//==- NativeEnumGlobals.cpp - Native Global Enumerator impl ------*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h"
+
+#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
+#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
+#include "llvm/DebugInfo/PDB/PDBSymbol.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+NativeEnumGlobals::NativeEnumGlobals(NativeSession &PDBSession,
+                                     std::vector<codeview::SymbolKind> Kinds)
+    : Index(0), Session(PDBSession) {
+  GlobalsStream &GS = cantFail(Session.getPDBFile().getPDBGlobalsStream());
+  SymbolStream &SS = cantFail(Session.getPDBFile().getPDBSymbolStream());
+  for (uint32_t Off : GS.getGlobalsTable()) {
+    CVSymbol S = SS.readRecord(Off);
+    if (!llvm::is_contained(Kinds, S.kind()))
+      continue;
+    MatchOffsets.push_back(Off);
+  }
+}
+
+uint32_t NativeEnumGlobals::getChildCount() const {
+  return static_cast<uint32_t>(MatchOffsets.size());
+}
+
+std::unique_ptr<PDBSymbol>
+NativeEnumGlobals::getChildAtIndex(uint32_t N) const {
+  if (N >= MatchOffsets.size())
+    return nullptr;
+
+  SymIndexId Id =
+      Session.getSymbolCache().getOrCreateGlobalSymbolByOffset(MatchOffsets[N]);
+  return Session.getSymbolCache().getSymbolById(Id);
+}
+
+std::unique_ptr<PDBSymbol> NativeEnumGlobals::getNext() {
+  return getChildAtIndex(Index++);
+}
+
+void NativeEnumGlobals::reset() { Index = 0; }

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp Mon Oct  1 10:55:38 2018
@@ -56,6 +56,8 @@ NativeExeSymbol::findChildren(PDB_SymTyp
   case PDB_SymType::FunctionSig:
     return Session.getSymbolCache().createTypeEnumerator(
         {codeview::LF_PROCEDURE, codeview::LF_MFUNCTION});
+  case PDB_SymType::Typedef:
+    return Session.getSymbolCache().createGlobalsEnumerator(codeview::S_UDT);
 
   default:
     break;

Added: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp?rev=343507&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeTypedef.cpp Mon Oct  1 10:55:38 2018
@@ -0,0 +1,27 @@
+#include "llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+NativeTypeTypedef::NativeTypeTypedef(NativeSession &Session, SymIndexId Id,
+                                     codeview::UDTSym Typedef)
+    : NativeRawSymbol(Session, PDB_SymType::Typedef, Id),
+      Record(std::move(Typedef)) {}
+
+NativeTypeTypedef::~NativeTypeTypedef() {}
+
+void NativeTypeTypedef::dump(raw_ostream &OS, int Indent,
+                             PdbSymbolIdField ShowIdFields,
+                             PdbSymbolIdField RecurseIdFields) const {
+  NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
+  dumpSymbolField(OS, "name", getName(), Indent);
+  dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session,
+                    PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
+}
+
+std::string NativeTypeTypedef::getName() const { return Record.Name; }
+
+SymIndexId NativeTypeTypedef::getTypeId() const {
+  return Session.getSymbolCache().findSymbolByTypeIndex(Record.Type);
+}

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp Mon Oct  1 10:55:38 2018
@@ -1,9 +1,12 @@
 #include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
 
+#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
 #include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
 #include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeEnumGlobals.h"
 #include "llvm/DebugInfo/PDB/Native/NativeEnumTypes.h"
 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
@@ -12,9 +15,11 @@
 #include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypeFunctionSig.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypePointer.h"
+#include "llvm/DebugInfo/PDB/Native/NativeTypeTypedef.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypeUDT.h"
 #include "llvm/DebugInfo/PDB/Native/NativeTypeVTShape.h"
 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
@@ -85,6 +90,12 @@ SymbolCache::createTypeEnumerator(std::v
       new NativeEnumTypes(Session, Types, std::move(Kinds)));
 }
 
+std::unique_ptr<IPDBEnumSymbols>
+SymbolCache::createGlobalsEnumerator(codeview::SymbolKind Kind) {
+  return std::unique_ptr<IPDBEnumSymbols>(
+      new NativeEnumGlobals(Session, {Kind}));
+}
+
 SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
                                          ModifierOptions Mods) {
   if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct)
@@ -247,6 +258,32 @@ uint32_t SymbolCache::getNumCompilands()
   return Dbi->modules().getModuleCount();
 }
 
+SymIndexId SymbolCache::getOrCreateGlobalSymbolByOffset(uint32_t Offset) {
+  auto Iter = GlobalOffsetToSymbolId.find(Offset);
+  if (Iter != GlobalOffsetToSymbolId.end())
+    return Iter->second;
+
+  SymbolStream &SS = cantFail(Session.getPDBFile().getPDBSymbolStream());
+  CVSymbol CVS = SS.readRecord(Offset);
+  SymIndexId Id = 0;
+  switch (CVS.kind()) {
+  case SymbolKind::S_UDT: {
+    UDTSym US = cantFail(SymbolDeserializer::deserializeAs<UDTSym>(CVS));
+    Id = createSymbol<NativeTypeTypedef>(std::move(US));
+    break;
+  }
+  default:
+    Id = createSymbolPlaceholder();
+    break;
+  }
+  if (Id != 0) {
+    assert(GlobalOffsetToSymbolId.count(Offset) == 0);
+    GlobalOffsetToSymbolId[Offset] = Id;
+  }
+
+  return Id;
+}
+
 std::unique_ptr<PDBSymbolCompiland>
 SymbolCache::getOrCreateCompiland(uint32_t Index) {
   if (!Dbi)

Added: llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-typedefs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-typedefs.test?rev=343507&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-typedefs.test (added)
+++ llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-typedefs.test Mon Oct  1 10:55:38 2018
@@ -0,0 +1,33 @@
+; Test that the native PDB reader can enumerate typedefs.  The output being
+; checked against is golden output generated by llvm-pdbutil without the
+; -native flag.  Then we check that we generate the same output.
+
+; RUN: llvm-pdbutil pretty -native -typedefs %p/../Inputs/symbolformat.pdb \
+; RUN:     | FileCheck -check-prefix=PRETTY %s
+
+; RUN: llvm-pdbutil diadump -native -typedefs %p/../Inputs/symbolformat.pdb \
+; RUN:     | FileCheck -check-prefix=DUMP %s
+
+PRETTY:      Typedefs: (3 items)
+PRETTY-NEXT:    typedef int IntType
+PRETTY-NEXT:    typedef class A ClassAType
+PRETTY-NEXT:    typedef int[3] int_array
+
+DUMP:      {
+DUMP-NEXT:   symIndexId: 2
+DUMP-NEXT:   symTag: Typedef
+DUMP-NEXT:   name: IntType
+DUMP-NEXT:   typeId: 3
+DUMP-NEXT: }
+DUMP-NEXT: {
+DUMP-NEXT:   symIndexId: 4
+DUMP-NEXT:   symTag: Typedef
+DUMP-NEXT:   name: ClassAType
+DUMP-NEXT:   typeId: 5
+DUMP-NEXT: }
+DUMP-NEXT: {
+DUMP-NEXT:   symIndexId: 6
+DUMP-NEXT:   symTag: Typedef
+DUMP-NEXT:   name: int_array
+DUMP-NEXT:   typeId: 7
+DUMP-NEXT: }

Modified: llvm/trunk/test/tools/llvm-pdbdump/type-qualifiers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-pdbdump/type-qualifiers.test?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-pdbdump/type-qualifiers.test (original)
+++ llvm/trunk/test/tools/llvm-pdbdump/type-qualifiers.test Mon Oct  1 10:55:38 2018
@@ -16,7 +16,7 @@
 ; GLOBALS_DATA-DAG: static volatile int* __restrict NS::p_data_member
 
 ; QUALS: ---TYPES---
-; QUALS-DAG: typedef RankNArray
+; QUALS-DAG: typedef volatile int*[100][10] RankNArray
 ; QUALS-DAG: typedef long* __restrict RestrictTypedef
 ; QUALS: union Union
 ; QUALS-DAG: int* __restrict x_member

Modified: llvm/trunk/tools/llvm-pdbutil/PrettyTypedefDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/PrettyTypedefDumper.cpp?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/PrettyTypedefDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/PrettyTypedefDumper.cpp Mon Oct  1 10:55:38 2018
@@ -12,6 +12,7 @@
 #include "LinePrinter.h"
 #include "PrettyBuiltinDumper.h"
 #include "PrettyFunctionDumper.h"
+#include "PrettyTypeDumper.h"
 
 #include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/PDBExtras.h"
@@ -35,7 +36,10 @@ void TypedefDumper::start(const PDBSymbo
                                                       << Symbol.getName();
 }
 
-void TypedefDumper::dump(const PDBSymbolTypeArray &Symbol) {}
+void TypedefDumper::dump(const PDBSymbolTypeArray &Symbol) {
+  TypeDumper Dumper(Printer);
+  Dumper.dump(Symbol);
+}
 
 void TypedefDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
   BuiltinDumper Dumper(Printer);

Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=343507&r1=343506&r2=343507&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Mon Oct  1 10:55:38 2018
@@ -197,6 +197,8 @@ static cl::opt<bool> Arrays("arrays", cl
                             cl::sub(DiaDumpSubcommand));
 static cl::opt<bool> VTShapes("vtshapes", cl::desc("Dump virtual table shapes"),
                               cl::sub(DiaDumpSubcommand));
+static cl::opt<bool> Typedefs("typedefs", cl::desc("Dump typedefs"),
+                              cl::sub(DiaDumpSubcommand));
 } // namespace diadump
 
 namespace pretty {
@@ -1027,6 +1029,8 @@ static void dumpDia(StringRef Path) {
     SymTypes.push_back(PDB_SymType::ArrayType);
   if (opts::diadump::VTShapes)
     SymTypes.push_back(PDB_SymType::VTableShape);
+  if (opts::diadump::Typedefs)
+    SymTypes.push_back(PDB_SymType::Typedef);
   PdbSymbolIdField Ids = opts::diadump::NoSymIndexIds ? PdbSymbolIdField::None
                                                       : PdbSymbolIdField::All;
 




More information about the llvm-commits mailing list