Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.
authorZachary Turner <zturner@google.com>
Tue, 10 Feb 2015 22:43:25 +0000 (22:43 +0000)
committerZachary Turner <zturner@google.com>
Tue, 10 Feb 2015 22:43:25 +0000 (22:43 +0000)
This makes llvm-pdbdump available on all platforms, although it
will currently fail to create a dumper if there is no PDB reader
implementation for the current platform.

It implements dumping of compilands and children, which is less
information than was previously available, but it has to be
rewritten from scratch using the new set of interfaces, so the
rest of the functionality will be added back in subsequent commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228755 91177308-0d34-0410-b5e6-96231b3b80d8

90 files changed:
include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h
include/llvm/DebugInfo/PDB/DIA/DIASession.h
include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
include/llvm/DebugInfo/PDB/IPDBSession.h
include/llvm/DebugInfo/PDB/IPDBSourceFile.h
include/llvm/DebugInfo/PDB/PDBExtras.h [new file with mode: 0644]
include/llvm/DebugInfo/PDB/PDBSymbol.h
include/llvm/DebugInfo/PDB/PDBSymbolAnnotation.h
include/llvm/DebugInfo/PDB/PDBSymbolBlock.h
include/llvm/DebugInfo/PDB/PDBSymbolCompiland.h
include/llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h
include/llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h
include/llvm/DebugInfo/PDB/PDBSymbolCustom.h
include/llvm/DebugInfo/PDB/PDBSymbolData.h
include/llvm/DebugInfo/PDB/PDBSymbolExe.h
include/llvm/DebugInfo/PDB/PDBSymbolFunc.h
include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h
include/llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h
include/llvm/DebugInfo/PDB/PDBSymbolLabel.h
include/llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h
include/llvm/DebugInfo/PDB/PDBSymbolThunk.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeArray.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h
include/llvm/DebugInfo/PDB/PDBSymbolTypePointer.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h
include/llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h
include/llvm/DebugInfo/PDB/PDBSymbolUnknown.h
include/llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h
include/llvm/DebugInfo/PDB/PDBTypes.h
lib/DebugInfo/PDB/CMakeLists.txt
lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
lib/DebugInfo/PDB/DIA/DIASession.cpp
lib/DebugInfo/PDB/IPDBSourceFile.cpp [new file with mode: 0644]
lib/DebugInfo/PDB/PDBExtras.cpp [new file with mode: 0644]
lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
lib/DebugInfo/PDB/PDBSymbol.cpp
lib/DebugInfo/PDB/PDBSymbolAnnotation.cpp
lib/DebugInfo/PDB/PDBSymbolBlock.cpp
lib/DebugInfo/PDB/PDBSymbolCompiland.cpp
lib/DebugInfo/PDB/PDBSymbolCompilandDetails.cpp
lib/DebugInfo/PDB/PDBSymbolCompilandEnv.cpp
lib/DebugInfo/PDB/PDBSymbolCustom.cpp
lib/DebugInfo/PDB/PDBSymbolData.cpp
lib/DebugInfo/PDB/PDBSymbolExe.cpp
lib/DebugInfo/PDB/PDBSymbolFunc.cpp
lib/DebugInfo/PDB/PDBSymbolFuncDebugEnd.cpp
lib/DebugInfo/PDB/PDBSymbolFuncDebugStart.cpp
lib/DebugInfo/PDB/PDBSymbolLabel.cpp
lib/DebugInfo/PDB/PDBSymbolPublicSymbol.cpp
lib/DebugInfo/PDB/PDBSymbolThunk.cpp
lib/DebugInfo/PDB/PDBSymbolTypeArray.cpp
lib/DebugInfo/PDB/PDBSymbolTypeBaseClass.cpp
lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp
lib/DebugInfo/PDB/PDBSymbolTypeCustom.cpp
lib/DebugInfo/PDB/PDBSymbolTypeDimension.cpp
lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
lib/DebugInfo/PDB/PDBSymbolTypeFriend.cpp
lib/DebugInfo/PDB/PDBSymbolTypeFunctionArg.cpp
lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp
lib/DebugInfo/PDB/PDBSymbolTypeManaged.cpp
lib/DebugInfo/PDB/PDBSymbolTypePointer.cpp
lib/DebugInfo/PDB/PDBSymbolTypeTypedef.cpp
lib/DebugInfo/PDB/PDBSymbolTypeUDT.cpp
lib/DebugInfo/PDB/PDBSymbolTypeVTable.cpp
lib/DebugInfo/PDB/PDBSymbolTypeVTableShape.cpp
lib/DebugInfo/PDB/PDBSymbolUnknown.cpp
lib/DebugInfo/PDB/PDBSymbolUsingNamespace.cpp
tools/CMakeLists.txt
tools/Makefile
tools/llvm-pdbdump/CMakeLists.txt
tools/llvm-pdbdump/COMExtras.h [deleted file]
tools/llvm-pdbdump/DIAExtras.cpp [deleted file]
tools/llvm-pdbdump/DIAExtras.h [deleted file]
tools/llvm-pdbdump/DIASymbol.cpp [deleted file]
tools/llvm-pdbdump/DIASymbol.h [deleted file]
tools/llvm-pdbdump/LLVMBuild.txt
tools/llvm-pdbdump/Makefile [new file with mode: 0644]
tools/llvm-pdbdump/llvm-pdbdump.cpp
tools/llvm-pdbdump/llvm-pdbdump.h [deleted file]
unittests/DebugInfo/PDB/PDBApiTest.cpp

index 08904907f550c729163587666e6f9909485df966..6336b319a4f08c74507085d1c5031d6f6df1c9d0 100644 (file)
@@ -19,8 +19,12 @@ class DIARawSymbol : public IPDBRawSymbol {
 public:
   DIARawSymbol(const DIASession &PDBSession, CComPtr<IDiaSymbol> DiaSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
+  CComPtr<IDiaSymbol> getDiaSymbol() const { return Symbol; }
+
+  std::unique_ptr<IPDBEnumSymbols>
+  DIARawSymbol::findChildren(PDB_SymType Type) const override;
   std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type, StringRef Name,
                PDB_NameSearchFlags Flags) const override;
@@ -54,7 +58,7 @@ public:
   uint32_t getLiveRangeStartAddressOffset() const override;
   uint32_t getLiveRangeStartAddressSection() const override;
   uint32_t getLiveRangeStartRelativeVirtualAddress() const override;
-  uint32_t getLocalBasePointerRegisterId() const override;
+  PDB_RegisterId getLocalBasePointerRegisterId() const override;
   uint32_t getLowerBoundId() const override;
   uint32_t getMemorySpaceKind() const override;
   std::string getName() const override;
@@ -69,7 +73,7 @@ public:
   uint32_t getOffsetInUdt() const override;
   PDB_Cpu getPlatform() const override;
   uint32_t getRank() const override;
-  uint32_t getRegisterId() const override;
+  PDB_RegisterId getRegisterId() const override;
   uint32_t getRegisterType() const override;
   uint32_t getRelativeVirtualAddress() const override;
   uint32_t getSamplerSlot() const override;
@@ -129,6 +133,7 @@ public:
   bool hasInlAsm() const override;
   bool hasInlineAttribute() const override;
   bool hasInterruptReturn() const override;
+  bool hasFramePointer() const override;
   bool hasLongJump() const override;
   bool hasManagedCode() const override;
   bool hasNestedTypes() const override;
index 7ee0cb02fd2b2929fea2dbe03b3b9e60979be6a0..141b9b0d98987f65a3206a1c374bef1415e11df0 100644 (file)
@@ -25,6 +25,10 @@ public:
   void setLoadAddress(uint64_t Address) override;
   std::unique_ptr<PDBSymbolExe> getGlobalScope() const override;
   std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
+
+  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
+  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
+      const PDBSymbolCompiland &Compiland) const override;
   std::unique_ptr<IPDBSourceFile>
   getSourceFileById(uint32_t FileId) const override;
 
index 960821d6ad696527cb8752e4fe24a5f7f9b98f35..5dd103ff100395ca0b9d653055f6a82336d7a56b 100644 (file)
@@ -29,7 +29,10 @@ class IPDBRawSymbol {
 public:
   virtual ~IPDBRawSymbol();
 
-  virtual void dump(llvm::raw_ostream &OS) const = 0;
+  virtual void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const = 0;
+
+  virtual std::unique_ptr<IPDBEnumSymbols>
+  findChildren(PDB_SymType Type) const = 0;
 
   virtual std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type, StringRef Name,
@@ -64,7 +67,7 @@ public:
   virtual uint32_t getLiveRangeStartAddressOffset() const = 0;
   virtual uint32_t getLiveRangeStartAddressSection() const = 0;
   virtual uint32_t getLiveRangeStartRelativeVirtualAddress() const = 0;
-  virtual uint32_t getLocalBasePointerRegisterId() const = 0;
+  virtual PDB_RegisterId getLocalBasePointerRegisterId() const = 0;
   virtual uint32_t getLowerBoundId() const = 0;
   virtual uint32_t getMemorySpaceKind() const = 0;
   virtual std::string getName() const = 0;
@@ -79,7 +82,7 @@ public:
   virtual uint32_t getOffsetInUdt() const = 0;
   virtual PDB_Cpu getPlatform() const = 0;
   virtual uint32_t getRank() const = 0;
-  virtual uint32_t getRegisterId() const = 0;
+  virtual PDB_RegisterId getRegisterId() const = 0;
   virtual uint32_t getRegisterType() const = 0;
   virtual uint32_t getRelativeVirtualAddress() const = 0;
   virtual uint32_t getSamplerSlot() const = 0;
@@ -136,6 +139,7 @@ public:
   virtual bool hasDebugInfo() const = 0;
   virtual bool hasEH() const = 0;
   virtual bool hasEHa() const = 0;
+  virtual bool hasFramePointer() const = 0;
   virtual bool hasInlAsm() const = 0;
   virtual bool hasInlineAttribute() const = 0;
   virtual bool hasInterruptReturn() const = 0;
index 5f16d94f932e9bd5143c0aa7c6ffe71fad630b1f..0e0b2c5f68e01a92c36a566fa25761bd2ef7ee8d 100644 (file)
@@ -16,6 +16,7 @@
 
 namespace llvm {
 
+class PDBSymbolCompiland;
 class PDBSymbolExe;
 
 /// IPDBSession defines an interface used to provide a context for querying
@@ -28,6 +29,10 @@ public:
   virtual void setLoadAddress(uint64_t Address) = 0;
   virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
   virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
+
+  virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
+  virtual std::unique_ptr<IPDBEnumSourceFiles>
+  getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
   virtual std::unique_ptr<IPDBSourceFile>
   getSourceFileById(uint32_t FileId) const = 0;
 
index 2b834e2d732a6620965d7f4e26f37900a95ece83..ae584d717e349ed1ffe5372a176c3a90416d9616 100644 (file)
 
 namespace llvm {
 
+class raw_ostream;
+
 /// IPDBSourceFile defines an interface used to represent source files whose
 /// information are stored in the PDB.
 class IPDBSourceFile {
 public:
   virtual ~IPDBSourceFile();
 
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const;
+
   virtual std::string getFileName() const = 0;
   virtual uint32_t getUniqueId() const = 0;
   virtual std::string getChecksum() const = 0;
diff --git a/include/llvm/DebugInfo/PDB/PDBExtras.h b/include/llvm/DebugInfo/PDB/PDBExtras.h
new file mode 100644 (file)
index 0000000..5a768e7
--- /dev/null
@@ -0,0 +1,39 @@
+//===- PDBExtras.h - helper functions and classes for PDBs -------*- 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_PDBEXTRAS_H
+#define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
+
+#include <unordered_map>
+
+#include "PDBTypes.h"
+
+#include "llvm/Support/raw_ostream.h"
+
+namespace llvm {
+typedef std::unordered_map<PDB_SymType, int> TagStats;
+
+struct stream_indent {
+  stream_indent(int IndentWidth) : Width(IndentWidth) {}
+  int Width;
+};
+raw_ostream &operator<<(raw_ostream &OS, const stream_indent &Indent);
+
+raw_ostream &operator<<(raw_ostream &OS, const PDB_RegisterId &Reg);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_LocType &Loc);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_ThunkOrdinal &Thunk);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_Checksum &Checksum);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_Lang &Lang);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
+raw_ostream &operator<<(raw_ostream &OS, const PDB_UniqueId &Id);
+raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
+raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
+}
+
+#endif
index ada3ab38994b425bd54b690d04b3375844f89739..95bc7fd44ec9e2ff2c3f33b486874c6e4133e659 100644 (file)
 #define LLVM_DEBUGINFO_PDB_IPDBSYMBOL_H
 
 #include <memory>
+#include <unordered_map>
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 
 #include "IPDBRawSymbol.h"
+#include "PDBExtras.h"
 #include "PDBTypes.h"
 
 #define FORWARD_SYMBOL_METHOD(MethodName)                                      \
@@ -48,10 +50,12 @@ public:
   /// call dump() on the underlying RawSymbol, which allows us to discover
   /// unknown properties, but individual implementations of PDBSymbol may
   /// override the behavior to only dump known fields.
-  virtual void dump(llvm::raw_ostream &OS) const;
+  virtual void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const = 0;
+  void defaultDump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const;
 
   PDB_SymType getSymTag() const;
 
+  std::unique_ptr<IPDBEnumSymbols> findChildren(PDB_SymType Type) const;
   std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type, StringRef Name,
                PDB_NameSearchFlags Flags) const;
@@ -61,7 +65,12 @@ public:
                                                      uint32_t RVA) const;
   std::unique_ptr<IPDBEnumSymbols> findInlineFramesByRVA(uint32_t RVA) const;
 
+  const IPDBRawSymbol &getRawSymbol() const { return *RawSymbol; }
+  IPDBRawSymbol &getRawSymbol() { return *RawSymbol; }
+
 protected:
+  std::unique_ptr<IPDBEnumSymbols> getChildStats(TagStats &Stats) const;
+
   const IPDBSession &Session;
   const std::unique_ptr<IPDBRawSymbol> RawSymbol;
 };
index 773c9925e70feef945ffa4ac4af5876ac847fe06..5751dcc9dd21b8f1f1ec927e27c5af6482a67db7 100644 (file)
@@ -23,7 +23,7 @@ public:
   PDBSymbolAnnotation(const IPDBSession &PDBSession,
                       std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index 5e6c7e193cb3717a82c7a83077ed6bd13b2dab13..760324b8c7deaad329408847c3c8b9bee5116b97 100644 (file)
@@ -23,7 +23,7 @@ public:
   PDBSymbolBlock(const IPDBSession &PDBSession,
                  std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index b4831aa3ac38af549145856e6adbaf1c2e9b7fc2..b342444aaf6f191d61af1cb3fd6bbc8a089b5163 100644 (file)
@@ -23,7 +23,7 @@ public:
   PDBSymbolCompiland(const IPDBSession &PDBSession,
                      std::unique_ptr<IPDBRawSymbol> CompilandSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(isEditAndContinueEnabled)
   FORWARD_SYMBOL_METHOD(getLexicalParentId)
index e498bdd52659cd6ba89e9ba354b5217929c36143..dcffabf34fda7b1e6d94f9e22e1945c5020d944f 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolCompilandDetails(const IPDBSession &PDBSession,
                             std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   void getFrontEndVersion(VersionInfo &Version) const {
     RawSymbol->getFrontEndVersion(Version);
index 4e732882c1d7e611e1fa9a7d79c5a4f813fe93ed..dfff3f754b6cbabed4caf60584cda0708cfd26e7 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolCompilandEnv(const IPDBSession &PDBSession,
                         std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getLexicalParentId)
   FORWARD_SYMBOL_METHOD(getName)
index 3d8c1fb4d944d5f7d7fb3e27d019c796667e779b..0c972d8ba083de1a46504077c1ad15693cba1d79 100644 (file)
@@ -27,7 +27,7 @@ public:
   PDBSymbolCustom(const IPDBSession &PDBSession,
                   std::unique_ptr<IPDBRawSymbol> CustomSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   void getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes);
   FORWARD_SYMBOL_METHOD(getSymIndexId)
index 22098e3bda0fe8d9cacfbaf474ff5d4e4d3dad8a..e1c074e7298ed02b8f6ea7b80b09d71baccf9157 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolData(const IPDBSession &PDBSession,
                 std::unique_ptr<IPDBRawSymbol> DataSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAccess)
   FORWARD_SYMBOL_METHOD(getAddressOffset)
index 5f03c440d3b55fd27b0be528f68f6ec6797840b6..caac1668ae30550ab55e4c79f858605b54aa7ff4 100644 (file)
@@ -24,7 +24,7 @@ public:
   PDBSymbolExe(const IPDBSession &PDBSession,
                std::unique_ptr<IPDBRawSymbol> ExeSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAge)
   FORWARD_SYMBOL_METHOD(getGuid)
index f101d3072d8d4a63cf21925de8cae8120e93d809..4b78c2f5a6cdcdf8ae69454793e57e0fba499b50 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolFunc(const IPDBSession &PDBSession,
                 std::unique_ptr<IPDBRawSymbol> FuncSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAccess)
   FORWARD_SYMBOL_METHOD(getAddressOffset)
@@ -46,8 +46,10 @@ public:
   FORWARD_SYMBOL_METHOD(isStatic)
   FORWARD_SYMBOL_METHOD(getLength)
   FORWARD_SYMBOL_METHOD(getLexicalParentId)
+  FORWARD_SYMBOL_METHOD(getLocalBasePointerRegisterId)
   FORWARD_SYMBOL_METHOD(getLocationType)
   FORWARD_SYMBOL_METHOD(getName)
+  FORWARD_SYMBOL_METHOD(hasFramePointer)
   FORWARD_SYMBOL_METHOD(hasNoInlineAttribute)
   FORWARD_SYMBOL_METHOD(hasNoReturnAttribute)
   FORWARD_SYMBOL_METHOD(isUnreached)
index 945596115c0ea3bc5109011219034949ecd74b59..15ce8969d47bcd6d4cef89529d02b25b8969f1fd 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolFuncDebugEnd(const IPDBSession &PDBSession,
                         std::unique_ptr<IPDBRawSymbol> FuncDebugEndSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index c3ccd2532b31a59f93765d54dfe40af0cc61e04b..9ad6d3888f79d83e6bf980a13026087f23690009 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolFuncDebugStart(const IPDBSession &PDBSession,
                           std::unique_ptr<IPDBRawSymbol> FuncDebugStartSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index 114bb378ca187a3aa49a29b82c70354ee91598af..d7cb6f5a6df33b7e6b75d5b1b413d9bd1eabdfc0 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolLabel(const IPDBSession &PDBSession,
                  std::unique_ptr<IPDBRawSymbol> LabelSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index 98d4c3bd749ccd80419d5fcb25e0e840e39dff8e..540cf19ac2fdaab482790ee8406fa776d404a16f 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolPublicSymbol(const IPDBSession &PDBSession,
                         std::unique_ptr<IPDBRawSymbol> PublicSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAddressOffset)
   FORWARD_SYMBOL_METHOD(getAddressSection)
index 136b6ca997a579d19204985dad4279077bf396c2..7a2eab204f67b21457da629d843421bb69f77e71 100644 (file)
@@ -24,7 +24,7 @@ public:
   PDBSymbolThunk(const IPDBSession &PDBSession,
                  std::unique_ptr<IPDBRawSymbol> ThunkSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAccess)
   FORWARD_SYMBOL_METHOD(getAddressOffset)
index 8100ea7e2920c4836c22debdf2766dd7d3f0daf3..ef81d792d3cf05cf84495edf152827b583e09702 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeArray(const IPDBSession &PDBSession,
                      std::unique_ptr<IPDBRawSymbol> ArrayTypeSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getArrayIndexTypeId)
   FORWARD_SYMBOL_METHOD(isConstType)
index 60c3dc280833cbc4e7e4944929221bb7d6fa13dd..3cc7a0226532245ab3a2499a555d3cbf7cf28913 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeBaseClass(const IPDBSession &PDBSession,
                          std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getAccess)
   FORWARD_SYMBOL_METHOD(getClassParentId)
index ba764ddb31b1ae920962004f30eb8b28955d0bdd..769d44740311ef769a53cfb7b2f59bfdf027d60b 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeBuiltin(const IPDBSession &PDBSession,
                        std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getBuiltinType)
   FORWARD_SYMBOL_METHOD(isConstType)
index a28a6efc2cc79320445b60594145c67a902aa9e7..7bdbc9de72ab55e1c5244bbd1de27dabd1ab621b 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeCustom(const IPDBSession &PDBSession,
                       std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getOemId)
   FORWARD_SYMBOL_METHOD(getOemSymbolId)
index 3039b87791884e97689d608f0a56a3b6278709bc..737fdfa6acd6d35585bd30ff0f43b698570bd714 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeDimension(const IPDBSession &PDBSession,
                          std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getLowerBoundId)
   FORWARD_SYMBOL_METHOD(getUpperBoundId)
index c44c4bede90e98bc2cb7093d424eff7c3d0eeb2d..63c16b17c465ae42a93c461421caf4694c48aa84 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeEnum(const IPDBSession &PDBSession,
                     std::unique_ptr<IPDBRawSymbol> EnumTypeSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getBuiltinType)
   FORWARD_SYMBOL_METHOD(getClassParentId)
index 8e7e93e719a3db557efb8b4a7a03398b63064c44..0c63da7d318002bcf3b9e6cbac1e09e52aae88d2 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeFriend(const IPDBSession &PDBSession,
                       std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getClassParentId)
   FORWARD_SYMBOL_METHOD(getName)
index c8f1e1dfa28b7d81f0e70c51456c5c4a3659bc1c..531ebda67b7491f8e10288bb6f0540fbe275653a 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeFunctionArg(const IPDBSession &PDBSession,
                            std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getClassParentId)
   FORWARD_SYMBOL_METHOD(getLexicalParentId)
index d23d7876fef75f2612569bbdc2b593b9bd33e587..91dab3ece953b21137485a4e60deba35aa687c48 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeFunctionSig(const IPDBSession &PDBSession,
                            std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getCallingConvention)
   FORWARD_SYMBOL_METHOD(getClassParentId)
index 436f51e450073f6ff69eabb26d506b1d1a3d1b6d..f5d02f9a60f4d5d345ef385cbee04eedf5d9dd16 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeManaged(const IPDBSession &PDBSession,
                        std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getName)
   FORWARD_SYMBOL_METHOD(getSymIndexId)
index 2236f9a077b11846362aa0f03137809d385dfc98..3a75edde2ab8e8572411a41209ec3bfa94a4da8c 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypePointer(const IPDBSession &PDBSession,
                        std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(isConstType)
   FORWARD_SYMBOL_METHOD(getLength)
index 4cb13cb2b037d6d6af672d1db33065202344bd5e..957d184b8584a8abab9af97f22ead3944eb21f26 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeTypedef(const IPDBSession &PDBSession,
                        std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getBuiltinType)
   FORWARD_SYMBOL_METHOD(getClassParentId)
index 7025502e13d141a8d672128dd0937960d092c7d2..2c86c84c331d8025ef205fd831dd15abe8900f4e 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeUDT(const IPDBSession &PDBSession,
                    std::unique_ptr<IPDBRawSymbol> UDTSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getClassParentId)
   FORWARD_SYMBOL_METHOD(hasConstructor)
index 0055969ae147275f2a3b9b794d20c929e3d60c88..0c9a916e44b3f548ad10bd82181bd2658518d6b6 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeVTable(const IPDBSession &PDBSession,
                       std::unique_ptr<IPDBRawSymbol> VtblSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getClassParentId)
   FORWARD_SYMBOL_METHOD(isConstType)
index f5d6a4aeec9d6139c4e90812abe0faf707c136bd..5055c8da62fd6df7121199c273826432bf7a7191 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolTypeVTableShape(const IPDBSession &PDBSession,
                            std::unique_ptr<IPDBRawSymbol> VtblShapeSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(isConstType)
   FORWARD_SYMBOL_METHOD(getCount)
index bcdb6835448b3491e5f14e003cf5049bb18790fc..cc8ab370235720b85bdcda9297faaf75b3f74166 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolUnknown(const IPDBSession &PDBSession,
                    std::unique_ptr<IPDBRawSymbol> UnknownSymbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   static bool classof(const PDBSymbol *S) {
     return (S->getSymTag() == PDB_SymType::None ||
index 861f81ab886bf7a63a2dfcca09c9d231aff0ba49..535dc8d0c3f1ff1dcc471e31baafcbbd4a98be2a 100644 (file)
@@ -22,7 +22,7 @@ public:
   PDBSymbolUsingNamespace(const IPDBSession &PDBSession,
                           std::unique_ptr<IPDBRawSymbol> Symbol);
 
-  void dump(llvm::raw_ostream &OS) const override;
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override;
 
   FORWARD_SYMBOL_METHOD(getLexicalParentId)
   FORWARD_SYMBOL_METHOD(getName)
index 836a423dbe7ea56539efed8eef51978301616d20..0009b02505a46f2c717b3007fa82100c720ed4fa 100644 (file)
@@ -11,6 +11,7 @@
 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
 
 #include <stdint.h>
+#include <functional>
 #include "llvm/Config/llvm-config.h"
 
 namespace llvm {
@@ -68,6 +69,12 @@ enum class PDB_ReaderType {
   DIA = 0,
 };
 
+enum class PDB_DumpLevel {
+  Compact,
+  Normal,
+  Detailed,
+};
+
 /// Defines a 128-bit unique identifier.  This maps to a GUID on Windows, but
 /// is abstracted here for the purposes of non-Windows platforms that don't have
 /// the GUID structure defined.
@@ -365,6 +372,58 @@ enum class PDB_BuiltinType {
   HResult = 31
 };
 
+enum class PDB_RegisterId {
+  Unknown = 0,
+  VFrame = 30006,
+  AL = 1,
+  CL = 2,
+  DL = 3,
+  BL = 4,
+  AH = 5,
+  CH = 6,
+  DH = 7,
+  BH = 8,
+  AX = 9,
+  CX = 10,
+  DX = 11,
+  BX = 12,
+  SP = 13,
+  BP = 14,
+  SI = 15,
+  DI = 16,
+  EAX = 17,
+  ECX = 18,
+  EDX = 19,
+  EBX = 20,
+  ESP = 21,
+  EBP = 22,
+  ESI = 23,
+  EDI = 24,
+  ES = 25,
+  CS = 26,
+  SS = 27,
+  DS = 28,
+  FS = 29,
+  GS = 30,
+  IP = 31,
+  RAX = 328,
+  RBX = 329,
+  RCX = 330,
+  RDX = 331,
+  RSI = 332,
+  RDI = 333,
+  RBP = 334,
+  RSP = 335,
+  R8 = 336,
+  R9 = 337,
+  R10 = 338,
+  R11 = 339,
+  R12 = 340,
+  R13 = 341,
+  R14 = 342,
+  R15 = 343,
+};
+
 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
 
 struct VersionInfo {
@@ -376,4 +435,15 @@ struct VersionInfo {
 
 } // namespace llvm
 
+namespace std {
+template <> struct hash<llvm::PDB_SymType> {
+  typedef llvm::PDB_SymType argument_type;
+  typedef std::size_t result_type;
+
+  result_type operator()(const argument_type &Arg) const {
+    return std::hash<int>()(static_cast<int>(Arg));
+  }
+};
+}
+
 #endif
index 007406cedb84f8669729331fb387f226a0279df1..00ad1caa46fa0f10d8b93ce870137a6e203101ad 100644 (file)
@@ -30,7 +30,9 @@ endif()
 list(APPEND LIBPDB_ADDITIONAL_HEADER_DIRS "../../../include/llvm/DebugInfo/PDB")
 
 add_llvm_library(LLVMDebugInfoPDB
+  IPDBSourceFile.cpp
   PDB.cpp
+  PDBExtras.cpp
   PDBInterfaceAnchors.cpp
   PDBSymbol.cpp
   PDBSymbolAnnotation.cpp
index 66d5edca1eb393618266baac7307fa33dd856f92..5c94f6e16ea62154650335d9149dac3ee3ab547b 100644 (file)
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
 #include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
@@ -54,13 +55,228 @@ PrivateGetDIAValue(IDiaSymbol *Symbol,
   ::memcpy(&IdResult, &Result, sizeof(GUID));
   return IdResult;
 }
+
+template <typename ArgType>
+void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+                  IDiaSymbol *Symbol,
+                  HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
+  ArgType Value;
+  if (S_OK == (Symbol->*Method)(&Value)) {
+    OS.indent(Indent);
+    OS << Name << ": " << Value << "\n";
+  }
+}
+
+void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+                  IDiaSymbol *Symbol,
+                  HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
+  BSTR Value = nullptr;
+  if (S_OK != (Symbol->*Method)(&Value))
+    return;
+  const char *Bytes = reinterpret_cast<const char *>(Value);
+  ArrayRef<char> ByteArray(Bytes, ::SysStringByteLen(Value));
+  std::string Result;
+  if (llvm::convertUTF16ToUTF8String(ByteArray, Result)) {
+    OS.indent(Indent);
+    OS << Name << ": " << Result << "\n";
+  }
+  ::SysFreeString(Value);
+}
+}
+
+namespace llvm {
+raw_ostream &operator<<(raw_ostream &OS, const GUID &Guid) {
+  const PDB_UniqueId *Id = reinterpret_cast<const PDB_UniqueId *>(&Guid);
+  OS << *Id;
+  return OS;
+}
 }
 
 DIARawSymbol::DIARawSymbol(const DIASession &PDBSession,
                            CComPtr<IDiaSymbol> DiaSymbol)
     : Session(PDBSession), Symbol(DiaSymbol) {}
 
-void DIARawSymbol::dump(llvm::raw_ostream &OS) const {}
+#define RAW_METHOD_DUMP(Stream, Method)                                        \
+  DumpDIAValue(Stream, Indent, StringRef(#Method), Symbol, &IDiaSymbol::Method);
+
+void DIARawSymbol::dump(raw_ostream &OS, int Indent,
+                        PDB_DumpLevel Level) const {
+  RAW_METHOD_DUMP(OS, get_access)
+  RAW_METHOD_DUMP(OS, get_addressOffset)
+  RAW_METHOD_DUMP(OS, get_addressSection)
+  RAW_METHOD_DUMP(OS, get_age)
+  RAW_METHOD_DUMP(OS, get_arrayIndexTypeId)
+  RAW_METHOD_DUMP(OS, get_backEndMajor)
+  RAW_METHOD_DUMP(OS, get_backEndMinor)
+  RAW_METHOD_DUMP(OS, get_backEndBuild)
+  RAW_METHOD_DUMP(OS, get_backEndQFE)
+  RAW_METHOD_DUMP(OS, get_baseDataOffset)
+  RAW_METHOD_DUMP(OS, get_baseDataSlot)
+  RAW_METHOD_DUMP(OS, get_baseSymbolId)
+  RAW_METHOD_DUMP(OS, get_builtInKind)
+  RAW_METHOD_DUMP(OS, get_bitPosition)
+  RAW_METHOD_DUMP(OS, get_callingConvention)
+  RAW_METHOD_DUMP(OS, get_classParentId)
+  RAW_METHOD_DUMP(OS, get_compilerName)
+  RAW_METHOD_DUMP(OS, get_count)
+  RAW_METHOD_DUMP(OS, get_countLiveRanges)
+  RAW_METHOD_DUMP(OS, get_frontEndMajor)
+  RAW_METHOD_DUMP(OS, get_frontEndMinor)
+  RAW_METHOD_DUMP(OS, get_frontEndBuild)
+  RAW_METHOD_DUMP(OS, get_frontEndQFE)
+  RAW_METHOD_DUMP(OS, get_count)
+  RAW_METHOD_DUMP(OS, get_lexicalParentId)
+  RAW_METHOD_DUMP(OS, get_libraryName)
+  RAW_METHOD_DUMP(OS, get_liveRangeStartAddressOffset)
+  RAW_METHOD_DUMP(OS, get_liveRangeStartAddressSection)
+  RAW_METHOD_DUMP(OS, get_liveRangeStartRelativeVirtualAddress)
+  RAW_METHOD_DUMP(OS, get_localBasePointerRegisterId)
+  RAW_METHOD_DUMP(OS, get_lowerBoundId)
+  RAW_METHOD_DUMP(OS, get_memorySpaceKind)
+  RAW_METHOD_DUMP(OS, get_name)
+  RAW_METHOD_DUMP(OS, get_numberOfAcceleratorPointerTags)
+  RAW_METHOD_DUMP(OS, get_numberOfColumns)
+  RAW_METHOD_DUMP(OS, get_numberOfModifiers)
+  RAW_METHOD_DUMP(OS, get_numberOfRegisterIndices)
+  RAW_METHOD_DUMP(OS, get_numberOfRows)
+  RAW_METHOD_DUMP(OS, get_objectFileName)
+  RAW_METHOD_DUMP(OS, get_oemId)
+  RAW_METHOD_DUMP(OS, get_oemSymbolId)
+  RAW_METHOD_DUMP(OS, get_offsetInUdt)
+  RAW_METHOD_DUMP(OS, get_platform)
+  RAW_METHOD_DUMP(OS, get_rank)
+  RAW_METHOD_DUMP(OS, get_registerId)
+  RAW_METHOD_DUMP(OS, get_registerType)
+  RAW_METHOD_DUMP(OS, get_relativeVirtualAddress)
+  RAW_METHOD_DUMP(OS, get_samplerSlot)
+  RAW_METHOD_DUMP(OS, get_signature)
+  RAW_METHOD_DUMP(OS, get_sizeInUdt)
+  RAW_METHOD_DUMP(OS, get_slot)
+  RAW_METHOD_DUMP(OS, get_sourceFileName)
+  RAW_METHOD_DUMP(OS, get_stride)
+  RAW_METHOD_DUMP(OS, get_subTypeId)
+  RAW_METHOD_DUMP(OS, get_symbolsFileName)
+  RAW_METHOD_DUMP(OS, get_symIndexId)
+  RAW_METHOD_DUMP(OS, get_targetOffset)
+  RAW_METHOD_DUMP(OS, get_targetRelativeVirtualAddress)
+  RAW_METHOD_DUMP(OS, get_targetVirtualAddress)
+  RAW_METHOD_DUMP(OS, get_targetSection)
+  RAW_METHOD_DUMP(OS, get_textureSlot)
+  RAW_METHOD_DUMP(OS, get_timeStamp)
+  RAW_METHOD_DUMP(OS, get_token)
+  RAW_METHOD_DUMP(OS, get_typeId)
+  RAW_METHOD_DUMP(OS, get_uavSlot)
+  RAW_METHOD_DUMP(OS, get_undecoratedName)
+  RAW_METHOD_DUMP(OS, get_unmodifiedTypeId)
+  RAW_METHOD_DUMP(OS, get_upperBoundId)
+  RAW_METHOD_DUMP(OS, get_virtualBaseDispIndex)
+  RAW_METHOD_DUMP(OS, get_virtualBaseOffset)
+  RAW_METHOD_DUMP(OS, get_virtualTableShapeId)
+  RAW_METHOD_DUMP(OS, get_dataKind)
+  RAW_METHOD_DUMP(OS, get_symTag)
+  RAW_METHOD_DUMP(OS, get_guid)
+  RAW_METHOD_DUMP(OS, get_offset)
+  RAW_METHOD_DUMP(OS, get_thisAdjust)
+  RAW_METHOD_DUMP(OS, get_virtualBasePointerOffset)
+  RAW_METHOD_DUMP(OS, get_locationType)
+  RAW_METHOD_DUMP(OS, get_machineType)
+  RAW_METHOD_DUMP(OS, get_thunkOrdinal)
+  RAW_METHOD_DUMP(OS, get_length)
+  RAW_METHOD_DUMP(OS, get_liveRangeLength)
+  RAW_METHOD_DUMP(OS, get_virtualAddress)
+  RAW_METHOD_DUMP(OS, get_udtKind)
+  RAW_METHOD_DUMP(OS, get_constructor)
+  RAW_METHOD_DUMP(OS, get_customCallingConvention)
+  RAW_METHOD_DUMP(OS, get_farReturn)
+  RAW_METHOD_DUMP(OS, get_code)
+  RAW_METHOD_DUMP(OS, get_compilerGenerated)
+  RAW_METHOD_DUMP(OS, get_constType)
+  RAW_METHOD_DUMP(OS, get_editAndContinueEnabled)
+  RAW_METHOD_DUMP(OS, get_function)
+  RAW_METHOD_DUMP(OS, get_stride)
+  RAW_METHOD_DUMP(OS, get_noStackOrdering)
+  RAW_METHOD_DUMP(OS, get_hasAlloca)
+  RAW_METHOD_DUMP(OS, get_hasAssignmentOperator)
+  RAW_METHOD_DUMP(OS, get_isCTypes)
+  RAW_METHOD_DUMP(OS, get_hasCastOperator)
+  RAW_METHOD_DUMP(OS, get_hasDebugInfo)
+  RAW_METHOD_DUMP(OS, get_hasEH)
+  RAW_METHOD_DUMP(OS, get_hasEHa)
+  RAW_METHOD_DUMP(OS, get_hasInlAsm)
+  RAW_METHOD_DUMP(OS, get_framePointerPresent)
+  RAW_METHOD_DUMP(OS, get_inlSpec)
+  RAW_METHOD_DUMP(OS, get_interruptReturn)
+  RAW_METHOD_DUMP(OS, get_hasLongJump)
+  RAW_METHOD_DUMP(OS, get_hasManagedCode)
+  RAW_METHOD_DUMP(OS, get_hasNestedTypes)
+  RAW_METHOD_DUMP(OS, get_noInline)
+  RAW_METHOD_DUMP(OS, get_noReturn)
+  RAW_METHOD_DUMP(OS, get_optimizedCodeDebugInfo)
+  RAW_METHOD_DUMP(OS, get_overloadedOperator)
+  RAW_METHOD_DUMP(OS, get_hasSEH)
+  RAW_METHOD_DUMP(OS, get_hasSecurityChecks)
+  RAW_METHOD_DUMP(OS, get_hasSetJump)
+  RAW_METHOD_DUMP(OS, get_strictGSCheck)
+  RAW_METHOD_DUMP(OS, get_isAcceleratorGroupSharedLocal)
+  RAW_METHOD_DUMP(OS, get_isAcceleratorPointerTagLiveRange)
+  RAW_METHOD_DUMP(OS, get_isAcceleratorStubFunction)
+  RAW_METHOD_DUMP(OS, get_isAggregated)
+  RAW_METHOD_DUMP(OS, get_intro)
+  RAW_METHOD_DUMP(OS, get_isCVTCIL)
+  RAW_METHOD_DUMP(OS, get_isConstructorVirtualBase)
+  RAW_METHOD_DUMP(OS, get_isCxxReturnUdt)
+  RAW_METHOD_DUMP(OS, get_isDataAligned)
+  RAW_METHOD_DUMP(OS, get_isHLSLData)
+  RAW_METHOD_DUMP(OS, get_isHotpatchable)
+  RAW_METHOD_DUMP(OS, get_indirectVirtualBaseClass)
+  RAW_METHOD_DUMP(OS, get_isInterfaceUdt)
+  RAW_METHOD_DUMP(OS, get_intrinsic)
+  RAW_METHOD_DUMP(OS, get_isLTCG)
+  RAW_METHOD_DUMP(OS, get_isLocationControlFlowDependent)
+  RAW_METHOD_DUMP(OS, get_isMSILNetmodule)
+  RAW_METHOD_DUMP(OS, get_isMatrixRowMajor)
+  RAW_METHOD_DUMP(OS, get_managed)
+  RAW_METHOD_DUMP(OS, get_msil)
+  RAW_METHOD_DUMP(OS, get_isMultipleInheritance)
+  RAW_METHOD_DUMP(OS, get_isNaked)
+  RAW_METHOD_DUMP(OS, get_nested)
+  RAW_METHOD_DUMP(OS, get_isOptimizedAway)
+  RAW_METHOD_DUMP(OS, get_packed)
+  RAW_METHOD_DUMP(OS, get_isPointerBasedOnSymbolValue)
+  RAW_METHOD_DUMP(OS, get_isPointerToDataMember)
+  RAW_METHOD_DUMP(OS, get_isPointerToMemberFunction)
+  RAW_METHOD_DUMP(OS, get_pure)
+  RAW_METHOD_DUMP(OS, get_RValueReference)
+  RAW_METHOD_DUMP(OS, get_isRefUdt)
+  RAW_METHOD_DUMP(OS, get_reference)
+  RAW_METHOD_DUMP(OS, get_restrictedType)
+  RAW_METHOD_DUMP(OS, get_isReturnValue)
+  RAW_METHOD_DUMP(OS, get_isSafeBuffers)
+  RAW_METHOD_DUMP(OS, get_scoped)
+  RAW_METHOD_DUMP(OS, get_isSdl)
+  RAW_METHOD_DUMP(OS, get_isSingleInheritance)
+  RAW_METHOD_DUMP(OS, get_isSplitted)
+  RAW_METHOD_DUMP(OS, get_isStatic)
+  RAW_METHOD_DUMP(OS, get_isStripped)
+  RAW_METHOD_DUMP(OS, get_unalignedType)
+  RAW_METHOD_DUMP(OS, get_notReached)
+  RAW_METHOD_DUMP(OS, get_isValueUdt)
+  RAW_METHOD_DUMP(OS, get_virtual)
+  RAW_METHOD_DUMP(OS, get_virtualBaseClass)
+  RAW_METHOD_DUMP(OS, get_isVirtualInheritance)
+  RAW_METHOD_DUMP(OS, get_volatileType)
+}
+
+std::unique_ptr<IPDBEnumSymbols>
+DIARawSymbol::findChildren(PDB_SymType Type) const {
+  enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+
+  CComPtr<IDiaEnumSymbols> DiaEnumerator;
+  if (S_OK != Symbol->findChildren(EnumVal, nullptr, nsNone, &DiaEnumerator))
+    return nullptr;
+
+  return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
+}
 
 std::unique_ptr<IPDBEnumSymbols>
 DIARawSymbol::findChildren(PDB_SymType Type, StringRef Name,
@@ -198,7 +414,7 @@ void DIARawSymbol::getFrontEndVersion(VersionInfo &Version) const {
 }
 
 PDB_Lang DIARawSymbol::getLanguage() const {
-  return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_count);
+  return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
 }
 
 uint32_t DIARawSymbol::getLexicalParentId() const {
@@ -224,9 +440,9 @@ uint32_t DIARawSymbol::getLiveRangeStartRelativeVirtualAddress() const {
       Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
 }
 
-uint32_t DIARawSymbol::getLocalBasePointerRegisterId() const {
-  return PrivateGetDIAValue(Symbol,
-                            &IDiaSymbol::get_localBasePointerRegisterId);
+PDB_RegisterId DIARawSymbol::getLocalBasePointerRegisterId() const {
+  return PrivateGetDIAValue<DWORD, PDB_RegisterId>(
+      Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
 }
 
 uint32_t DIARawSymbol::getLowerBoundId() const {
@@ -286,8 +502,9 @@ uint32_t DIARawSymbol::getRank() const {
   return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_rank);
 }
 
-uint32_t DIARawSymbol::getRegisterId() const {
-  return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_registerId);
+PDB_RegisterId DIARawSymbol::getRegisterId() const {
+  return PrivateGetDIAValue<DWORD, PDB_RegisterId>(Symbol,
+                                                   &IDiaSymbol::get_registerId);
 }
 
 uint32_t DIARawSymbol::getRegisterType() const {
@@ -486,7 +703,7 @@ bool DIARawSymbol::isFunction() const {
 }
 
 bool DIARawSymbol::getAddressTaken() const {
-  return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_stride);
+  return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressTaken);
 }
 
 bool DIARawSymbol::getNoStackOrdering() const {
@@ -533,6 +750,10 @@ bool DIARawSymbol::hasInterruptReturn() const {
   return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_interruptReturn);
 }
 
+bool DIARawSymbol::hasFramePointer() const {
+  return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_framePointerPresent);
+}
+
 bool DIARawSymbol::hasLongJump() const {
   return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasLongJump);
 }
index 3b5c951e2bac5d858b3e1dbd773c9cdc7bad08bb..0df2354e0185a72983b8939f26ce8f55b30fd295 100644 (file)
@@ -7,11 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h"
 #include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
 #include "llvm/DebugInfo/PDB/DIA/DIASourceFile.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 #include "llvm/Support/ConvertUTF.h"
 
 using namespace llvm;
@@ -75,6 +78,27 @@ std::unique_ptr<PDBSymbol> DIASession::getSymbolById(uint32_t SymbolId) const {
   return PDBSymbol::create(*this, std::move(RawSymbol));
 }
 
+std::unique_ptr<IPDBEnumSourceFiles> DIASession::getAllSourceFiles() const {
+  CComPtr<IDiaEnumSourceFiles> Files;
+  if (S_OK != Session->findFile(nullptr, nullptr, nsNone, &Files))
+    return nullptr;
+
+  return std::make_unique<DIAEnumSourceFiles>(*this, Files);
+}
+
+std::unique_ptr<IPDBEnumSourceFiles> DIASession::getSourceFilesForCompiland(
+    const PDBSymbolCompiland &Compiland) const {
+  CComPtr<IDiaEnumSourceFiles> Files;
+
+  const DIARawSymbol &RawSymbol =
+      static_cast<const DIARawSymbol &>(Compiland.getRawSymbol());
+  if (S_OK !=
+      Session->findFile(RawSymbol.getDiaSymbol(), nullptr, nsNone, &Files))
+    return nullptr;
+
+  return std::make_unique<DIAEnumSourceFiles>(*this, Files);
+}
+
 std::unique_ptr<IPDBSourceFile>
 DIASession::getSourceFileById(uint32_t FileId) const {
   CComPtr<IDiaSourceFile> LocatedFile;
diff --git a/lib/DebugInfo/PDB/IPDBSourceFile.cpp b/lib/DebugInfo/PDB/IPDBSourceFile.cpp
new file mode 100644 (file)
index 0000000..f3e0284
--- /dev/null
@@ -0,0 +1,34 @@
+//===- IPDBSourceFile.cpp - base interface for a PDB source file *- 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/IPDBSourceFile.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+IPDBSourceFile::~IPDBSourceFile() {}
+
+void IPDBSourceFile::dump(raw_ostream &OS, int Indent,
+                          PDB_DumpLevel Level) const {
+  if (Level == PDB_DumpLevel::Compact) {
+    OS.indent(Indent);
+    PDB_Checksum ChecksumType = getChecksumType();
+    OS << "[";
+    if (ChecksumType != PDB_Checksum::None) {
+      OS << ChecksumType << ": ";
+      std::string Checksum = getChecksum();
+      for (uint8_t c : Checksum)
+        OS << format_hex_no_prefix(c, 2, true);
+    } else
+      OS << "No checksum";
+    OS << "] " << getFileName() << "\n";
+  }
+}
diff --git a/lib/DebugInfo/PDB/PDBExtras.cpp b/lib/DebugInfo/PDB/PDBExtras.cpp
new file mode 100644 (file)
index 0000000..60e5368
--- /dev/null
@@ -0,0 +1,219 @@
+//===- PDBExtras.cpp - helper functions and classes for PDBs -----*- 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/PDBExtras.h"
+#include "llvm/ADT/ArrayRef.h"
+
+using namespace llvm;
+
+#define CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, Str, Stream)                  \
+  case Class::Value:                                                           \
+    Stream << Str;                                                             \
+    break;
+
+#define CASE_OUTPUT_ENUM_CLASS_NAME(Class, Value, Stream)                      \
+  CASE_OUTPUT_ENUM_CLASS_STR(Class, Value, #Value, Stream)
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const stream_indent &Indent) {
+  OS.indent(Indent.Width);
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_RegisterId &Reg) {
+  switch (Reg) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AL, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CL, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DL, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BL, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AH, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CH, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DH, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BH, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, AX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, BP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EAX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ECX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EDX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EBX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ESP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EBP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ESI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, EDI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, ES, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, CS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, SS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, DS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, FS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, GS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, IP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RAX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RBX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RCX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RDX, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RSI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RDI, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RBP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, RSP, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R8, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R9, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R10, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R11, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R12, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R13, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R14, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_RegisterId, R15, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_LocType &Loc) {
+  switch (Loc) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, Static, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, TLS, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, RegRel, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, ThisRel, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, Enregistered, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, BitField, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, Slot, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, IlRel, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, MetaData, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_LocType, Constant, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_ThunkOrdinal &Thunk) {
+  switch (Thunk) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, BranchIsland, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Pcode, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Standard, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, ThisAdjustor, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, TrampIncremental, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, UnknownLoad, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_ThunkOrdinal, Vcall, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_Checksum &Checksum) {
+  switch (Checksum) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, None, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, MD5, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Checksum, SHA1, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_Lang &Lang) {
+  switch (Lang) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, C, OS)
+    CASE_OUTPUT_ENUM_CLASS_STR(PDB_Lang, Cpp, "C++", OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Fortran, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Masm, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Pascal, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Basic, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cobol, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Link, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtres, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Cvtpgd, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, CSharp, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, VB, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, ILAsm, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, Java, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, JScript, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, MSIL, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_Lang, HLSL, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_SymType &Tag) {
+  switch (Tag) {
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Exe, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Compiland, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandDetails, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CompilandEnv, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Function, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Block, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Data, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Annotation, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Label, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PublicSymbol, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UDT, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Enum, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionSig, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, PointerType, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ArrayType, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BuiltinType, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Typedef, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, BaseClass, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Friend, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FunctionArg, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugStart, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, FuncDebugEnd, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, UsingNamespace, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTableShape, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, VTable, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Custom, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Thunk, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, CustomType, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, ManagedType, OS)
+    CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SymType, Dimension, OS)
+  default:
+    OS << "Unknown";
+  }
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const PDB_UniqueId &Id) {
+  static const char *Lookup = "0123456789ABCDEF";
+
+  static_assert(sizeof(PDB_UniqueId) == 16, "Expected 16-byte GUID");
+  ArrayRef<uint8_t> GuidBytes(reinterpret_cast<const uint8_t*>(&Id), 16);
+  OS << "{";
+  for (int i=0; i < 16;) {
+    uint8_t Byte = GuidBytes[i];
+    uint8_t HighNibble = (Byte >> 4) & 0xF;
+    uint8_t LowNibble = Byte & 0xF;
+    OS << Lookup[HighNibble] << Lookup[LowNibble];
+    ++i;
+    if (i>=4 && i<=10 && i%2==0)
+      OS << "-";
+  }
+  OS << "}";
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const VersionInfo &Version) {
+  OS << Version.Major << "." << Version.Minor << "." << Version.Build;
+  return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const TagStats &Stats) {
+  for (auto Tag : Stats) {
+    OS << Tag.first << ":" << Tag.second << " ";
+  }
+  return OS;
+}
index 8b430cf71037e9117b0f8f0f17172578a562ec8e..1183af1091415004f2b895e27b7c8107de98f482 100644 (file)
@@ -25,6 +25,4 @@ IPDBDataStream::~IPDBDataStream() {}
 
 IPDBRawSymbol::~IPDBRawSymbol() {}
 
-IPDBSourceFile::~IPDBSourceFile() {}
-
 IPDBLineNumber::~IPDBLineNumber() {}
index bbc395284bcce734ad813e0e03e5c4f263ab9069..d65a153623aa0e2acae1e37cd10e4fc1a3cb76e4 100644 (file)
@@ -98,10 +98,17 @@ PDBSymbol::create(const IPDBSession &PDBSession,
   }
 }
 
-void PDBSymbol::dump(llvm::raw_ostream &OS) const { RawSymbol->dump(OS); }
+void PDBSymbol::defaultDump(raw_ostream &OS, int Indent,
+                            PDB_DumpLevel Level) const {
+  RawSymbol->dump(OS, Indent, Level);
+}
 
 PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
 
+std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findChildren(PDB_SymType Type) const {
+  return RawSymbol->findChildren(Type);
+}
+
 std::unique_ptr<IPDBEnumSymbols>
 PDBSymbol::findChildren(PDB_SymType Type, StringRef Name,
                         PDB_NameSearchFlags Flags) const {
@@ -118,3 +125,14 @@ std::unique_ptr<IPDBEnumSymbols>
 PDBSymbol::findInlineFramesByRVA(uint32_t RVA) const {
   return RawSymbol->findInlineFramesByRVA(RVA);
 }
+
+std::unique_ptr<IPDBEnumSymbols>
+PDBSymbol::getChildStats(TagStats &Stats) const {
+  std::unique_ptr<IPDBEnumSymbols> Result(findChildren(PDB_SymType::None));
+  Stats.clear();
+  while (auto Child = Result->getNext()) {
+    ++Stats[Child->getSymTag()];
+  }
+  Result->reset();
+  return Result;
+}
index ed30c7dba6ed2cec1025a4c7ce2b0eb1233b216c..224a9a57dd799a8fac39495a0da2bf35ec6cb225 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolAnnotation::PDBSymbolAnnotation(const IPDBSession &PDBSession,
                                          std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolAnnotation::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolAnnotation::dump(raw_ostream &OS, int Indent,
+                               PDB_DumpLevel Level) const {}
index b5c738fa30ba24dbf77efc791c7bf58546a18b8f..9f401067c18ee5dec315ba448e7cf4e2ab7405c1 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolBlock::PDBSymbolBlock(const IPDBSession &PDBSession,
                                std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolBlock::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolBlock::dump(raw_ostream &OS, int Indent,
+                          PDB_DumpLevel Level) const {}
index 02a48fd51f089fc6e175014f489c1ea77485b46f..13f6cccd0a2df92f7f3d320aa91fe47b3ccea69a 100644 (file)
@@ -8,11 +8,16 @@
 //===----------------------------------------------------------------------===//
 
 #include <utility>
+#include <vector>
 
 #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/PDBSymbolCompiland.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
@@ -21,5 +26,73 @@ PDBSymbolCompiland::PDBSymbolCompiland(const IPDBSession &PDBSession,
                                        std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolCompiland::dump(llvm::raw_ostream &OS) const {
+void PDBSymbolCompiland::dump(raw_ostream &OS, int Indent,
+                              PDB_DumpLevel Level) const {
+  std::string Name = getName();
+  OS << "---- [IDX: " << getSymIndexId() << "] Compiland: " << Name
+     << " ----\n";
+
+  std::string Source = getSourceFileName();
+  std::string Library = getLibraryName();
+  if (!Source.empty())
+    OS << stream_indent(Indent + 2) << "Source: " << this->getSourceFileName()
+       << "\n";
+  if (!Library.empty())
+    OS << stream_indent(Indent + 2) << "Library: " << this->getLibraryName()
+       << "\n";
+
+  TagStats Stats;
+  auto ChildrenEnum = getChildStats(Stats);
+  OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
+  if (Level >= PDB_DumpLevel::Normal) {
+    while (auto Child = ChildrenEnum->getNext()) {
+      if (llvm::isa<PDBSymbolCompilandDetails>(*Child))
+        continue;
+      if (llvm::isa<PDBSymbolCompilandEnv>(*Child))
+        continue;
+      Child->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
+    }
+  }
+
+  std::unique_ptr<IPDBEnumSymbols> DetailsEnum(
+      findChildren(PDB_SymType::CompilandDetails));
+  if (auto DetailsPtr = DetailsEnum->getNext()) {
+    const auto *CD = dyn_cast<PDBSymbolCompilandDetails>(DetailsPtr.get());
+    assert(CD && "We only asked for compilands, but got something else!");
+    VersionInfo FE;
+    VersionInfo BE;
+    CD->getFrontEndVersion(FE);
+    CD->getBackEndVersion(BE);
+    OS << stream_indent(Indent + 2) << "Compiler: " << CD->getCompilerName()
+       << "\n";
+    OS << stream_indent(Indent + 2) << "Version: " << FE << ", " << BE << "\n";
+
+    OS << stream_indent(Indent + 2) << "Lang: " << CD->getLanguage() << "\n";
+    OS << stream_indent(Indent + 2) << "Attributes: ";
+    if (CD->hasDebugInfo())
+      OS << "DebugInfo ";
+    if (CD->isDataAligned())
+      OS << "DataAligned ";
+    if (CD->isLTCG())
+      OS << "LTCG ";
+    if (CD->hasSecurityChecks())
+      OS << "SecurityChecks ";
+    if (CD->isHotpatchable())
+      OS << "HotPatchable";
+
+    OS << "\n";
+    auto Files(Session.getSourceFilesForCompiland(*this));
+    if (Level >= PDB_DumpLevel::Detailed) {
+      OS << stream_indent(Indent + 2) << Files->getChildCount()
+         << " source files:\n";
+      while (auto File = Files->getNext())
+        File->dump(OS, Indent + 4, PDB_DumpLevel::Compact);
+    } else {
+      OS << stream_indent(Indent + 2) << Files->getChildCount()
+         << " source files\n";
+    }
+  }
+  uint32_t Count = DetailsEnum->getChildCount();
+  if (Count > 1)
+    OS << stream_indent(Indent + 2) << "(" << Count - 1 << " more omitted)\n";
 }
index c50848e455d8aca85d96ec0f55242c312e8f72f7..86844beab1c70b3273be0345d9ab49d352ad9781 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolCompilandDetails::PDBSymbolCompilandDetails(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolCompilandDetails::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolCompilandDetails::dump(raw_ostream &OS, int Indent,
+                                     PDB_DumpLevel Level) const {}
index 8ad90ee5295db740d90057e874467c1a17f3a348..ad1533968b512b98c6018c3f3c6d8a040c9e4d73 100644 (file)
@@ -24,4 +24,5 @@ std::string PDBSymbolCompilandEnv::getValue() const {
   return std::string();
 }
 
-void PDBSymbolCompilandEnv::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolCompilandEnv::dump(raw_ostream &OS, int Indent,
+                                 PDB_DumpLevel Level) const {}
index 0d44334f1025267fe3e10f5616f209f3b108eb6d..55334f32776c0f467e6674136c289ee31e8a3326 100644 (file)
@@ -23,4 +23,5 @@ void PDBSymbolCustom::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) {
   RawSymbol->getDataBytes(bytes);
 }
 
-void PDBSymbolCustom::dump(llvm::raw_ostream &OS) const {}
\ No newline at end of file
+void PDBSymbolCustom::dump(raw_ostream &OS, int Indent,
+                           PDB_DumpLevel Level) const {}
\ No newline at end of file
index e93307fba4d5f3a8b5f6a8054ebf03675e56c70a..f605af2677124ce8bc0f248f578beadd13e8d2cc 100644 (file)
@@ -8,12 +8,59 @@
 //===----------------------------------------------------------------------===//
 
 #include <utility>
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
 
+#include "llvm/Support/Format.h"
+
 using namespace llvm;
 
 PDBSymbolData::PDBSymbolData(const IPDBSession &PDBSession,
                              std::unique_ptr<IPDBRawSymbol> DataSymbol)
     : PDBSymbol(PDBSession, std::move(DataSymbol)) {}
 
-void PDBSymbolData::dump(llvm::raw_ostream &OS) const {}
\ No newline at end of file
+void PDBSymbolData::dump(raw_ostream &OS, int Indent,
+                         PDB_DumpLevel Level) const {
+  OS.indent(Indent);
+  if (Level == PDB_DumpLevel::Compact) {
+    PDB_LocType Loc = getLocationType();
+    OS << Loc << " data [";
+    switch (Loc) {
+    case PDB_LocType::Static:
+      OS << format_hex(getRelativeVirtualAddress(), 10);
+      break;
+    case PDB_LocType::TLS:
+      OS << getAddressSection() << ":" << format_hex(getAddressOffset(), 10);
+      break;
+    case PDB_LocType::RegRel:
+      OS << getRegisterId() << " + " << getOffset() << "]";
+      break;
+    case PDB_LocType::ThisRel:
+      OS << "this + " << getOffset() << "]";
+      break;
+    case PDB_LocType::Enregistered:
+      OS << getRegisterId() << "]";
+      break;
+    case PDB_LocType::BitField: {
+      uint32_t Offset = getOffset();
+      uint32_t BitPos = getBitPosition();
+      uint32_t Length = getLength();
+      uint32_t StartBits = 8 - BitPos;
+      uint32_t MiddleBytes = (Length - StartBits) / 8;
+      uint32_t EndBits = Length - StartBits - MiddleBytes * 8;
+      OS << format_hex(Offset, 10) << ":" << BitPos;
+      OS << " - " << format_hex(Offset + MiddleBytes, 10) << ":" << EndBits;
+      break;
+    }
+    case PDB_LocType::Slot:
+      OS << getSlot();
+    case PDB_LocType::IlRel:
+    case PDB_LocType::MetaData:
+    case PDB_LocType::Constant:
+    default:
+      OS << "???";
+    }
+    OS << "] ";
+  }
+  OS << getName() << "\n";
+}
\ No newline at end of file
index 494c51c9b9174d10f627756ca5760aed5b33eaec..c058949991bfaac68b10fdce5a9f356fd5b272d6 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <utility>
 
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 #include "llvm/Support/ConvertUTF.h"
@@ -21,5 +23,28 @@ PDBSymbolExe::PDBSymbolExe(const IPDBSession &PDBSession,
                            std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolExe::dump(llvm::raw_ostream &OS) const {
+void PDBSymbolExe::dump(raw_ostream &OS, int Indent,
+                        PDB_DumpLevel Level) const {
+  std::string FileName(getSymbolsFileName());
+
+  OS << "Summary for " << FileName << "\n";
+
+  TagStats Stats;
+  auto ChildrenEnum = getChildStats(Stats);
+  OS << stream_indent(Indent + 2) << "Children: " << Stats << "\n";
+
+  uint64_t FileSize = 0;
+  if (!llvm::sys::fs::file_size(FileName, FileSize))
+    OS << "  Size: " << FileSize << " bytes\n";
+  else
+    OS << "  Size: (Unable to obtain file size)\n";
+  PDB_UniqueId Guid = getGuid();
+  OS << "  Guid: " << Guid << "\n";
+  OS << "  Age: " << getAge() << "\n";
+  OS << "  Attributes: ";
+  if (hasCTypes())
+    OS << "HasCTypes ";
+  if (hasPrivateSymbols())
+    OS << "HasPrivateSymbols ";
+  OS << "\n";
 }
index 38959f1445f9e944c1552097954971da0cf61581..fcd533cb6c6015e669839478728f701dac90a692 100644 (file)
@@ -9,13 +9,55 @@
 
 #include <utility>
 
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
 
-using namespace llvm;
+#include "llvm/Support/Format.h"
 
+using namespace llvm;
 PDBSymbolFunc::PDBSymbolFunc(const IPDBSession &PDBSession,
                              std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolFunc::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
+                         PDB_DumpLevel Level) const {
+  bool doFullDump = false;
+  if (Level == PDB_DumpLevel::Compact) {
+    uint32_t FuncStart = getRelativeVirtualAddress();
+    uint32_t FuncEnd = FuncStart + getLength();
+    auto DebugEndSymbol = findChildren(PDB_SymType::FuncDebugEnd);
+    OS << stream_indent(Indent);
+    OS << "[" << format_hex(FuncStart, 8);
+    if (auto DebugStartEnum = findChildren(PDB_SymType::FuncDebugStart)) {
+      if (auto StartSym = DebugStartEnum->getNext()) {
+        auto DebugStart = dyn_cast<PDBSymbolFuncDebugStart>(StartSym.get());
+        OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
+      }
+    }
+    OS << " - " << format_hex(FuncEnd, 8);
+    if (auto DebugEndEnum = findChildren(PDB_SymType::FuncDebugEnd)) {
+      if (auto DebugEndSym = DebugEndEnum->getNext()) {
+        auto DebugEnd = dyn_cast<PDBSymbolFuncDebugEnd>(DebugEndSym.get());
+        OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress();
+      }
+    }
+    OS << "] ";
+    PDB_RegisterId Reg = getLocalBasePointerRegisterId();
+    if (Reg == PDB_RegisterId::VFrame)
+      OS << "(VFrame)";
+    else if (hasFramePointer()) {
+      if (Reg == PDB_RegisterId::EBP)
+        OS << "(EBP)";
+      else
+        OS << "(" << (int)Reg << ")";
+    } else {
+      OS << "(FPO)";
+      doFullDump = true;
+    }
+    OS << " " << getName() << "\n";
+  }
+  OS.flush();
+}
index 826d835a23614fe8786504fb8dc9e9cb422a2756..29766d0bae434fb281a6eb77aef86a66e88cdcb7 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolFuncDebugEnd::PDBSymbolFuncDebugEnd(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolFuncDebugEnd::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolFuncDebugEnd::dump(raw_ostream &OS, int Indent,
+                                 PDB_DumpLevel Level) const {}
index 3ad10d0cb43e991820bb1d4dde18c2f396f81f17..d78d945f7872534568bfdd7b6bb410afd2e0d217 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolFuncDebugStart::PDBSymbolFuncDebugStart(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolFuncDebugStart::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolFuncDebugStart::dump(raw_ostream &OS, int Indent,
+                                   PDB_DumpLevel Level) const {}
index ab2d1a74b5bba15168cca456174ec0eb6da3d438..50d1e2a9b6b394b280c1c8dbea82f7c159a7348d 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolLabel::PDBSymbolLabel(const IPDBSession &PDBSession,
                                std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolLabel::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolLabel::dump(raw_ostream &OS, int Indent,
+                          PDB_DumpLevel Level) const {}
index b94374a95e57894137405c28c8224fb02494db19..bb4400aeed1cd7a9c6e90faed719ff99f44a6bd4 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolPublicSymbol::PDBSymbolPublicSymbol(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolPublicSymbol::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolPublicSymbol::dump(raw_ostream &OS, int Indent,
+                                 PDB_DumpLevel Level) const {}
index f1a8936357bc29b461582fb7686ca352dcf27ac8..a7bd96a3479d013603af2aea2473f1e6706b149a 100644 (file)
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
 
+#include "llvm/Support/Format.h"
+
 using namespace llvm;
 
 PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
                                std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolThunk::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
+                          PDB_DumpLevel Level) const {
+  if (Level == PDB_DumpLevel::Compact) {
+    OS.indent(Indent);
+    PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
+    OS << "THUNK[" << Ordinal << "] ";
+    OS << "[" << format_hex(getRelativeVirtualAddress(), 10);
+    if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
+      OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
+    OS << "] ";
+    std::string Name = getName();
+    if (!Name.empty())
+      OS << Name;
+    OS << "\n";
+  }
+}
index 12fe8650cccc5fb58962f8526be2ef786ca0daa5..856d3aabef86ae76aa4c12a1880ab7f14b591029 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeArray::PDBSymbolTypeArray(const IPDBSession &PDBSession,
                                        std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeArray::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeArray::dump(raw_ostream &OS, int Indent,
+                              PDB_DumpLevel Level) const {}
index 7a94aa5cfe6e3378247bbe6d0badecda7f7af481..31a2e517f3f920c5a8a7e0dcc4cf4c55cc286fc7 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeBaseClass::PDBSymbolTypeBaseClass(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeBaseClass::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeBaseClass::dump(raw_ostream &OS, int Indent,
+                                  PDB_DumpLevel Level) const {}
index e1d00aecb57d5e6e4b19e7b8259769f8e0c92b18..1a68f8c8ded626491cdb495734442ca977a26c19 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeBuiltin::PDBSymbolTypeBuiltin(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeBuiltin::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeBuiltin::dump(raw_ostream &OS, int Indent,
+                                PDB_DumpLevel Level) const {}
index 2b78c9036ce34f26504edd646cdb283b54155c92..da9d41df801032c6fb5fd3d6381fdb4c620b38ed 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeCustom::PDBSymbolTypeCustom(const IPDBSession &PDBSession,
                                          std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeCustom::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeCustom::dump(raw_ostream &OS, int Indent,
+                               PDB_DumpLevel Level) const {}
index 7912164f4f4cf072295a5fa28824e250df313ed6..4bf20d051d9f255c04ce04ff69d677c1719b0975 100644 (file)
@@ -19,4 +19,5 @@ PDBSymbolTypeDimension::PDBSymbolTypeDimension(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeDimension::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeDimension::dump(raw_ostream &OS, int Indent,
+                                  PDB_DumpLevel Level) const {}
index 133ccea0f7c427c54afd7e2098dbbc43ba256ba8..4bc3b7b7860c38dd3c68beb4ecd8e4893ce85525 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeEnum::PDBSymbolTypeEnum(const IPDBSession &PDBSession,
                                      std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeEnum::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeEnum::dump(raw_ostream &OS, int Indent,
+                             PDB_DumpLevel Level) const {}
index 303d2b14b37d826779e3967cd3f76fedf9f18a64..ce02d5174e0fa1a0648a4870525cad380549585c 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeFriend::PDBSymbolTypeFriend(const IPDBSession &PDBSession,
                                          std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeFriend::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeFriend::dump(raw_ostream &OS, int Indent,
+                               PDB_DumpLevel Level) const {}
index 9a1af4f88fd3f5b1f7c6920fada666eca8ac0acb..86c337d1b0475e020967ea6ca895ba99bec454d9 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeFunctionArg::PDBSymbolTypeFunctionArg(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeFunctionArg::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeFunctionArg::dump(raw_ostream &OS, int Indent,
+                                    PDB_DumpLevel Level) const {}
index c31185ef7b668bb4273fe5359bcfc550fdc58d96..99953ad21cb5afb149712cd662f57e97984107d0 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeFunctionSig::PDBSymbolTypeFunctionSig(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeFunctionSig::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeFunctionSig::dump(raw_ostream &OS, int Indent,
+                                    PDB_DumpLevel Level) const {}
index 2a024f599062d83fa0e4ef8f6d2559694fe21852..d3728ea6ba0b2863816b5a2774ab24f34b0c3597 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeManaged::PDBSymbolTypeManaged(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeManaged::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeManaged::dump(raw_ostream &OS, int Indent,
+                                PDB_DumpLevel Level) const {}
index 95ea850011d78ba91cfbf5f8ae1f2cead40fb2de..a6625b36f7984b445aa768fdc93d7d3d7e6b313f 100644 (file)
@@ -19,4 +19,5 @@ PDBSymbolTypePointer::PDBSymbolTypePointer(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypePointer::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent,
+                                PDB_DumpLevel Level) const {}
index 8b4fd5d4bb41df238f19d1f6d58073b9ed307a2a..74cfeebbb0527821acc952a9c3398c020a22fcd5 100644 (file)
 
 #include <utility>
 
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
 using namespace llvm;
 
 PDBSymbolTypeTypedef::PDBSymbolTypeTypedef(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeTypedef::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeTypedef::dump(raw_ostream &OS, int Indent,
+                                PDB_DumpLevel Level) const {
+  OS.indent(Indent);
+  OS << "typedef:" << getName() << " -> ";
+  std::string TargetTypeName;
+  auto TypeSymbol = Session.getSymbolById(getTypeId());
+  if (PDBSymbolTypeUDT *UDT = dyn_cast<PDBSymbolTypeUDT>(TypeSymbol.get())) {
+    TargetTypeName = UDT->getName();
+  }
+  OS << TargetTypeName << "\n";
+}
index bd09fbad8a0d4c89f684ea7b1627d32542b637f8..13f6223bcb618e895989c37fc777a9344b814d9d 100644 (file)
@@ -18,4 +18,5 @@ 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) const {}
index 52169bb40aa4ce9b969062b4b8572d50986e4817..31c41d1d2683a59fe99b53777dfd8f58072a11fe 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeVTable::PDBSymbolTypeVTable(const IPDBSession &PDBSession,
                                          std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeVTable::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeVTable::dump(raw_ostream &OS, int Indent,
+                               PDB_DumpLevel Level) const {}
index 186f86f537dc369155a0d50db70004550a247c68..5a2fac0eba2308af09f63a318a174233a49b682f 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolTypeVTableShape::PDBSymbolTypeVTableShape(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolTypeVTableShape::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolTypeVTableShape::dump(raw_ostream &OS, int Indent,
+                                    PDB_DumpLevel Level) const {}
index 56b70232c3d341281c062559378ed668934a5c01..5db34e5835ded6aa80520e1bb959b96519a4c83a 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolUnknown::PDBSymbolUnknown(const IPDBSession &PDBSession,
                                    std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolUnknown::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolUnknown::dump(raw_ostream &OS, int Indent,
+                            PDB_DumpLevel Level) const {}
index 05590677cf1126e07efe5ba43243310fa5fcd2d0..0d4b2fe08bc702885027dab08ea907c2c77045d0 100644 (file)
@@ -18,4 +18,5 @@ PDBSymbolUsingNamespace::PDBSymbolUsingNamespace(
     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
     : PDBSymbol(PDBSession, std::move(Symbol)) {}
 
-void PDBSymbolUsingNamespace::dump(llvm::raw_ostream &OS) const {}
+void PDBSymbolUsingNamespace::dump(raw_ostream &OS, int Indent,
+                                   PDB_DumpLevel Level) const {}
index 26d2dfde931a09573a8ac9b007a51be367edee63..1f415b620dfcb1a9386e855545caece010e27290 100644 (file)
@@ -61,14 +61,7 @@ add_llvm_tool_subdirectory(yaml2obj)
 
 add_llvm_tool_subdirectory(llvm-go)
 
-if(MSVC AND NOT(MSVC_VERSION LESS 1800))
-  # Certain aspects of llvm-pdbdump require language support only present in
-  # MSVC 2013 and higher.  Since this is strictly a utility, and since we hope
-  # to drop support for MSVC 2012 soon, don't build this for MSVC < 2013.
-  add_llvm_tool_subdirectory(llvm-pdbdump)
-else()
-  ignore_llvm_tool_subdirectory(llvm-pdbdump)
-endif()
+add_llvm_tool_subdirectory(llvm-pdbdump)
 
 if(NOT CYGWIN AND LLVM_ENABLE_PIC)
   add_llvm_tool_subdirectory(lto)
index b559edacd52d8693a42b31cef6f64117f203fbf4..fcb6c647e3adda05d0780d09bfc38e09e6f7b805 100644 (file)
@@ -33,7 +33,7 @@ PARALLEL_DIRS := opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link \
                  macho-dump llvm-objdump llvm-readobj llvm-rtdyld \
                  llvm-dwarfdump llvm-cov llvm-size llvm-stress llvm-mcmarkup \
                  llvm-profdata llvm-symbolizer obj2yaml yaml2obj llvm-c-test \
-                 llvm-vtabledump verify-uselistorder dsymutil
+                 llvm-vtabledump verify-uselistorder dsymutil llvm-pdbdump
 
 # If Intel JIT Events support is configured, build an extra tool to test it.
 ifeq ($(USE_INTEL_JITEVENTS), 1)
index 6cad395b28127a6f2ed53bebb1b4675816b7043a..a3bb408097cc5f9d0780f9bb5e763be7fa9aa5c8 100644 (file)
@@ -1,28 +1,8 @@
-set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
+set(LLVM_LINK_COMPONENTS
+  Support
+  DebugInfoPDB
+  )
 
-# Due to a bug in MSVC 2013's installation software, it is possible
-# for MSVC 2013 to write the DIA SDK into the Visual Studio 2012
-# install directory.  If this happens, the installation is corrupt
-# and there's nothing we can do.  It happens with enough frequency
-# though that we should handle it.  We do so by simply checking that
-# the DIA SDK folder exists.  Should this happen you will need to
-# uninstall VS 2012 and then re-install VS 2013.
-if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
-  set(LLVM_LINK_COMPONENTS
-    Support
-    )
-
-  include_directories(${MSVC_DIA_SDK_DIR}/include)
-  if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-    link_directories(${MSVC_DIA_SDK_DIR}/lib/amd64)
-  else()
-    link_directories(${MSVC_DIA_SDK_DIR}/lib)
-  endif()
-
-  add_llvm_tool(llvm-pdbdump
-    llvm-pdbdump.cpp
-    DIAExtras.cpp
-    DIASymbol.cpp
-    )
-  target_link_libraries(llvm-pdbdump diaguids)
-endif()
+add_llvm_tool(llvm-pdbdump
+  llvm-pdbdump.cpp
+  )
diff --git a/tools/llvm-pdbdump/COMExtras.h b/tools/llvm-pdbdump/COMExtras.h
deleted file mode 100644 (file)
index 500f571..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-//===- COMExtras.h - Helper files for COM operations -------------*- C++-*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVM_PDBDUMP_COMEXTRAS_H
-#define LLVM_TOOLS_LLVM_PDBDUMP_COMEXTRAS_H
-
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/ConvertUTF.h"
-
-#include <tuple>
-
-namespace llvm {
-
-template <typename F> struct function_traits;
-
-#if LLVM_HAS_VARIADIC_TEMPLATES
-template <typename R, typename... Args>
-struct function_traits<R (*)(Args...)> : public function_traits<R(Args...)> {};
-
-template <typename C, typename R, typename... Args>
-struct function_traits<R (__stdcall C::*)(Args...)> {
-  using args_tuple = std::tuple<Args...>;
-};
-#else
-
-// For the sake of COM, we only need a 3 argument version and a 5 argument
-// version. We could provide 1, 2, 4, and other length of argument lists if
-// this were intended to be more generic.  Alternatively, this will "just work"
-// if VS2012 support is dropped and we can use the variadic template case
-// exclusively.
-template <typename C, typename R, typename A1, typename A2, typename A3>
-struct function_traits<R (__stdcall C::*)(A1, A2, A3)> {
-  typedef std::tuple<A1, A2, A3> args_tuple;
-};
-
-template <typename C, typename R, typename A1, typename A2, typename A3,
-          typename A4, typename A5>
-struct function_traits<R (__stdcall C::*)(A1, A2, A3, A4, A5)> {
-  typedef std::tuple<A1, A2, A3, A4, A5> args_tuple;
-};
-#endif
-
-template <class FuncTraits, std::size_t arg> struct function_arg {
-  // Writing function_arg as a separate class that accesses the tuple from
-  // function_traits is necessary due to what appears to be a bug in MSVC.
-  // If you write a nested class inside function_traits like this:
-  // template<std::size_t ArgIndex>
-  // struct Argument
-  // {
-  //   typedef typename
-  //     std::tuple_element<ArgIndex, std::tuple<Args...>>::type type;
-  // };
-  // MSVC encounters a parsing error.
-  typedef
-      typename std::tuple_element<arg, typename FuncTraits::args_tuple>::type
-          type;
-};
-
-template <class T> struct remove_double_pointer {};
-template <class T> struct remove_double_pointer<T **> { typedef T type; };
-
-namespace sys {
-namespace windows {
-
-/// A helper class for allowing the use of COM enumerators in range-based
-/// for loops.
-///
-/// A common idiom in the COM world is to have an enumerator interface, say
-/// IMyEnumerator.  It's responsible for enumerating over some child data type,
-/// say IChildType.  You do the enumeration by calling IMyEnumerator::Next()
-/// one of whose arguments will be an IChildType**.  Eventually Next() fails,
-/// indicating that there are no more items.
-///
-/// com_iterator represents a single point-in-time of this iteration.  It is
-/// used by ComEnumerator to support iterating in this fashion via range-based
-/// for loops and other common C++ paradigms.
-template <class EnumeratorType, std::size_t ArgIndex> class com_iterator {
-  using FunctionTraits = function_traits<decltype(&EnumeratorType::Next)>;
-  typedef typename function_arg<FunctionTraits, ArgIndex>::type FuncArgType;
-  // FuncArgType is now something like ISomeCOMInterface **.  Remove both
-  // pointers, so we can make a CComPtr<T> out of it.
-  typedef typename remove_double_pointer<FuncArgType>::type EnumDataType;
-
-  CComPtr<EnumeratorType> EnumeratorObject;
-  CComPtr<EnumDataType> CurrentItem;
-
-public:
-  typedef CComPtr<EnumDataType> value_type;
-  typedef std::ptrdiff_t difference_type;
-  typedef value_type *pointer_type;
-  typedef value_type &reference_type;
-  typedef std::forward_iterator_tag iterator_category;
-
-  explicit com_iterator(CComPtr<EnumeratorType> Enumerator,
-                        CComPtr<EnumDataType> Current)
-      : EnumeratorObject(Enumerator), CurrentItem(Current) {}
-  com_iterator() {}
-
-  com_iterator &operator++() {
-    // EnumeratorObject->Next() expects CurrentItem to be NULL.
-    CurrentItem.Release();
-    ULONG Count = 0;
-    HRESULT hr = EnumeratorObject->Next(1, &CurrentItem, &Count);
-    if (FAILED(hr) || Count == 0)
-      *this = com_iterator();
-
-    return *this;
-  }
-
-  value_type operator*() { return CurrentItem; }
-
-  bool operator==(const com_iterator &other) const {
-    return (EnumeratorObject == other.EnumeratorObject) &&
-           (CurrentItem == other.CurrentItem);
-  }
-
-  bool operator!=(const com_iterator &other) const { return !(*this == other); }
-
-  com_iterator &operator=(const com_iterator &other) {
-    EnumeratorObject = other.EnumeratorObject;
-    CurrentItem = other.CurrentItem;
-    return *this;
-  }
-};
-
-/// ComEnumerator implements the interfaced required for C++ to allow its use
-/// in range-based for loops.  In particular, a begin() and end() method.
-/// These methods simply construct and return an appropriate ComIterator
-/// instance.
-template <class EnumeratorType, std::size_t ArgIndex> class com_enumerator {
-  typedef function_traits<decltype(&EnumeratorType::Next)> FunctionTraits;
-  typedef typename function_arg<FunctionTraits, ArgIndex>::type FuncArgType;
-  typedef typename remove_double_pointer<FuncArgType>::type EnumDataType;
-
-  CComPtr<EnumeratorType> EnumeratorObject;
-
-public:
-  com_enumerator(CComPtr<EnumeratorType> Enumerator)
-      : EnumeratorObject(Enumerator) {}
-
-  com_iterator<EnumeratorType, ArgIndex> begin() {
-    if (!EnumeratorObject)
-      return end();
-
-    EnumeratorObject->Reset();
-    ULONG Count = 0;
-    CComPtr<EnumDataType> FirstItem;
-    HRESULT hr = EnumeratorObject->Next(1, &FirstItem, &Count);
-    return (FAILED(hr) || Count == 0) ? end()
-                                      : com_iterator<EnumeratorType, ArgIndex>(
-                                            EnumeratorObject, FirstItem);
-  }
-
-  com_iterator<EnumeratorType, ArgIndex> end() {
-    return com_iterator<EnumeratorType, ArgIndex>();
-  }
-};
-
-/// A helper class for allowing the use of COM record enumerators in range-
-/// based for loops.
-///
-/// A record enumerator is almost the same as a regular enumerator, except
-/// that it returns raw byte-data instead of interfaces to other COM objects.
-/// As a result, the enumerator's Next() method has a slightly different
-/// signature, and an iterator dereferences to an ArrayRef instead of a
-/// CComPtr.
-template <class EnumeratorType> class com_data_record_iterator {
-public:
-  typedef llvm::ArrayRef<uint8_t> value_type;
-  typedef std::ptrdiff_t difference_type;
-  typedef value_type *pointer_type;
-  typedef value_type &reference_type;
-  typedef std::forward_iterator_tag iterator_category;
-
-  explicit com_data_record_iterator(CComPtr<EnumeratorType> enumerator)
-      : Enumerator(enumerator), CurrentRecord(0) {
-    // Make sure we start at the beginning.  If there are no records,
-    // immediately set ourselves equal to end().
-    if (enumerator)
-      enumerator->Reset();
-
-    if (!ReadNextRecord())
-      *this = com_data_record_iterator();
-  }
-  com_data_record_iterator() {}
-
-  com_data_record_iterator &operator++() {
-    ++CurrentRecord;
-    // If we can't read any more records, either because there are no more
-    // or because we encountered an error, we should compare equal to end.
-    if (!ReadNextRecord())
-      *this = com_data_record_iterator();
-    return *this;
-  }
-
-  value_type operator*() {
-    return llvm::ArrayRef<uint8_t>(RecordData.begin(), RecordData.end());
-  }
-
-  bool operator==(const com_data_record_iterator &other) const {
-    return (Enumerator == other.Enumerator) &&
-           (CurrentRecord == other.CurrentRecord);
-  }
-
-  bool operator!=(const com_data_record_iterator &other) const {
-    return !(*this == other);
-  }
-
-private:
-  bool ReadNextRecord() {
-    RecordData.clear();
-    ULONG Count = 0;
-    DWORD RequiredBufferSize;
-    HRESULT hr = Enumerator->Next(1, 0, &RequiredBufferSize, nullptr, &Count);
-    if (hr == S_OK) {
-      RecordData.resize(RequiredBufferSize);
-      DWORD BytesRead = 0;
-      hr = Enumerator->Next(1, RequiredBufferSize, &BytesRead,
-                            RecordData.data(), &Count);
-    }
-    if (hr != S_OK)
-      RecordData.clear();
-    return (hr == S_OK);
-  }
-
-  CComPtr<EnumeratorType> Enumerator;
-  uint32_t CurrentRecord;
-  llvm::SmallVector<uint8_t, 32> RecordData;
-};
-
-/// Similar to ComEnumerator, com_data_record_enumerator implements the range
-/// interface for ComDataRecordIterators.
-template <class EnumeratorType> class com_data_record_enumerator {
-public:
-  com_data_record_enumerator(CComPtr<EnumeratorType> enumerator)
-      : Enumerator(enumerator) {}
-
-  com_data_record_iterator<EnumeratorType> begin() {
-    return com_data_record_iterator<EnumeratorType>(Enumerator);
-  }
-
-  com_data_record_iterator<EnumeratorType> end() {
-    LONG NumElts = 0;
-    HRESULT hr = Enumerator->get_Count(&NumElts);
-    return (FAILED(hr)) ? com_data_record_iterator<EnumeratorType>(Enumerator)
-                        : com_data_record_iterator<EnumeratorType>();
-  }
-
-private:
-  CComPtr<EnumeratorType> Enumerator;
-};
-
-/// com_enumerator is a simple helper function to allow the enumerator
-/// class's type to be inferred automatically.
-/// This allows you to write simply:
-///   for (auto item : com_enumerator(MyEnumerator)) {
-///   }
-template <class EnumeratorType>
-com_enumerator<EnumeratorType, 1>
-make_com_enumerator(CComPtr<EnumeratorType> Enumerator) {
-  return com_enumerator<EnumeratorType, 1>(Enumerator);
-}
-
-/// com_data_record_enumerator is a simple helper function to allow the
-/// enumerator class's type to be inferred automatically.
-/// This allows you to write simply:
-///   for (auto item : com_data_record_enumerator(MyEnumerator)) {
-///   }
-//=============================================================================
-template <class EnumeratorType>
-com_data_record_enumerator<EnumeratorType>
-make_com_data_record_enumerator(CComPtr<EnumeratorType> Enumerator) {
-  return com_data_record_enumerator<EnumeratorType>(Enumerator);
-}
-
-inline bool BSTRToUTF8(BSTR String16, std::string &String8) {
-  UINT ByteLength = ::SysStringByteLen(String16);
-  char *Bytes = reinterpret_cast<char *>(String16);
-  String8.clear();
-  return llvm::convertUTF16ToUTF8String(ArrayRef<char>(Bytes, ByteLength),
-                                        String8);
-}
-
-} // namespace windows
-} // namespace sys
-} // namespace llvm
-
-#endif
diff --git a/tools/llvm-pdbdump/DIAExtras.cpp b/tools/llvm-pdbdump/DIAExtras.cpp
deleted file mode 100644 (file)
index f08c42e..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-//===- DIAExtras.cpp - Helper classes and functions for DIA C++ ---------*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include "llvm/Support/Format.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include "llvm-pdbdump.h"
-#include "DIAExtras.h"
-
-using namespace llvm;
-using namespace llvm::sys::windows;
-
-#define PRINT_ENUM_VALUE_CASE(Value, Name)                                     \
-  case Value:                                                                  \
-    outs() << Name;                                                            \
-    break;
-
-raw_ostream &llvm::operator<<(raw_ostream &Stream, DiaSymTagEnum SymTag) {
-  switch (SymTag) {
-    PRINT_ENUM_VALUE_CASE(SymTagNull, "Null")
-    PRINT_ENUM_VALUE_CASE(SymTagExe, "Exe")
-    PRINT_ENUM_VALUE_CASE(SymTagCompiland, "Compiland")
-    PRINT_ENUM_VALUE_CASE(SymTagCompilandDetails, "CompilandDetails")
-    PRINT_ENUM_VALUE_CASE(SymTagCompilandEnv, "CompilandEnv")
-    PRINT_ENUM_VALUE_CASE(SymTagFunction, "Function")
-    PRINT_ENUM_VALUE_CASE(SymTagBlock, "Block")
-    PRINT_ENUM_VALUE_CASE(SymTagData, "Data")
-    PRINT_ENUM_VALUE_CASE(SymTagAnnotation, "Annotation")
-    PRINT_ENUM_VALUE_CASE(SymTagLabel, "Label")
-    PRINT_ENUM_VALUE_CASE(SymTagPublicSymbol, "PublicSymbol")
-    PRINT_ENUM_VALUE_CASE(SymTagUDT, "UDT")
-    PRINT_ENUM_VALUE_CASE(SymTagEnum, "Enum")
-    PRINT_ENUM_VALUE_CASE(SymTagFunctionType, "FunctionType")
-    PRINT_ENUM_VALUE_CASE(SymTagPointerType, "PointerType")
-    PRINT_ENUM_VALUE_CASE(SymTagArrayType, "ArrayType")
-    PRINT_ENUM_VALUE_CASE(SymTagBaseType, "BaseType")
-    PRINT_ENUM_VALUE_CASE(SymTagTypedef, "Typedef")
-    PRINT_ENUM_VALUE_CASE(SymTagBaseClass, "BaseClass")
-    PRINT_ENUM_VALUE_CASE(SymTagFriend, "Friend")
-    PRINT_ENUM_VALUE_CASE(SymTagFunctionArgType, "FunctionArgType")
-    PRINT_ENUM_VALUE_CASE(SymTagFuncDebugStart, "FuncDebugStart")
-    PRINT_ENUM_VALUE_CASE(SymTagFuncDebugEnd, "FuncDebugEnd")
-    PRINT_ENUM_VALUE_CASE(SymTagUsingNamespace, "UsingNamespace")
-    PRINT_ENUM_VALUE_CASE(SymTagVTableShape, "VTableShape")
-    PRINT_ENUM_VALUE_CASE(SymTagVTable, "VTable")
-    PRINT_ENUM_VALUE_CASE(SymTagCustom, "Custom")
-    PRINT_ENUM_VALUE_CASE(SymTagThunk, "Thunk")
-    PRINT_ENUM_VALUE_CASE(SymTagCustomType, "CustomType")
-    PRINT_ENUM_VALUE_CASE(SymTagManagedType, "ManagedType")
-    PRINT_ENUM_VALUE_CASE(SymTagDimension, "Dimension")
-    PRINT_ENUM_VALUE_CASE(SymTagCallSite, "CallSite")
-    PRINT_ENUM_VALUE_CASE(SymTagInlineSite, "InlineSite")
-    PRINT_ENUM_VALUE_CASE(SymTagBaseInterface, "BaseInterface")
-    PRINT_ENUM_VALUE_CASE(SymTagVectorType, "VectorType")
-    PRINT_ENUM_VALUE_CASE(SymTagMatrixType, "MatrixType")
-    PRINT_ENUM_VALUE_CASE(SymTagHLSLType, "HLSLType")
-#if (_MSC_FULL_VER >= 180031101)
-    PRINT_ENUM_VALUE_CASE(SymTagCaller, "Caller")
-    PRINT_ENUM_VALUE_CASE(SymTagCallee, "Callee")
-#endif
-    PRINT_ENUM_VALUE_CASE(SymTagMax, "Max")
-  }
-  outs() << " {" << (DWORD)SymTag << "}";
-  return Stream;
-}
-
-raw_ostream &llvm::operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType) {
-  switch (CpuType) {
-    PRINT_ENUM_VALUE_CASE(CV_CFL_8080, "8080")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_8086, "8086")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_80286, "80286")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_80386, "80386")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_80486, "80486")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUM, "Pentium")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMPRO, "Pentium Pro")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PENTIUMIII, "Pentium III")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS, "MIPS")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS16, "MIPS 16")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS32, "MIPS 32")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPS64, "MIPS 64")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSI, "MIPS I")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSII, "MIPS II")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIII, "MIPS III")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSIV, "MIPS IV")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_MIPSV, "MIPS V")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M68000, "M68000")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M68010, "M68010")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M68020, "M68020")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M68030, "M68030")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M68040, "M68040")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA, "Alpha")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164, "Alpha 21164")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21164A, "Alpha 21164A")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21264, "Alpha 21264")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ALPHA_21364, "21364")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPC601, "PowerPC 601")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPC603, "PowerPC 603")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPC604, "PowerPC 604")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPC620, "PowerPC 620")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPCFP, "PowerPC FP")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_PPCBE, "PowerPC BE")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_SH3, "SH3")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_SH3E, "SH3-E")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_SH3DSP, "SH3-DSP")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_SH4, "SH4")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_SHMEDIA, "SH Media")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM3, "ARM 3")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4, "ARM 4")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM4T, "ARM 4T")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5, "ARM 5")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM5T, "ARM 5T")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM6, "ARM 6")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_XMAC, "ARM XMAC")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM_WMMX, "ARM WMMX")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM7, "ARM 7")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_OMNI, "Omni")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_IA64, "IA64")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_IA64_2, "IA64-2")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_CEE, "CEE")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_AM33, "AM33")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_M32R, "M32R")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_TRICORE, "TriCore")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_X64, "X64")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_EBC, "EBC")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_THUMB, "Thumb")
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARMNT, "ARM NT")
-#if (_MSC_FULL_VER >= 180031101)
-    PRINT_ENUM_VALUE_CASE(CV_CFL_ARM64, "ARM 64")
-#endif
-    PRINT_ENUM_VALUE_CASE(CV_CFL_D3D11_SHADER, "D3D11 Shader")
-  }
-  outs() << " {" << llvm::format_hex((DWORD)CpuType, 2, true) << "}";
-  return Stream;
-}
-
-raw_ostream &llvm::operator<<(raw_ostream &Stream,
-                              MachineTypeEnum MachineType) {
-  switch (MachineType) {
-    PRINT_ENUM_VALUE_CASE(MachineTypeUnknown, "Unknown")
-    PRINT_ENUM_VALUE_CASE(MachineTypeX86, "x86")
-    PRINT_ENUM_VALUE_CASE(MachineTypeR3000, "R3000")
-    PRINT_ENUM_VALUE_CASE(MachineTypeR4000, "R4000")
-    PRINT_ENUM_VALUE_CASE(MachineTypeR10000, "R10000")
-    PRINT_ENUM_VALUE_CASE(MachineTypeWCEMIPSv2, "WCE MIPSv2")
-    PRINT_ENUM_VALUE_CASE(MachineTypeAlpha, "Alpha")
-    PRINT_ENUM_VALUE_CASE(MachineTypeSH3, "SH3")
-    PRINT_ENUM_VALUE_CASE(MachineTypeSH3DSP, "SH3-DSP")
-    PRINT_ENUM_VALUE_CASE(MachineTypeSH3E, "SH3-E")
-    PRINT_ENUM_VALUE_CASE(MachineTypeSH4, "SH4")
-    PRINT_ENUM_VALUE_CASE(MachineTypeSH5, "SH5")
-    PRINT_ENUM_VALUE_CASE(MachineTypeArm, "ARM")
-    PRINT_ENUM_VALUE_CASE(MachineTypeThumb, "Thumb")
-    PRINT_ENUM_VALUE_CASE(MachineTypeArmNT, "ARM NT")
-    PRINT_ENUM_VALUE_CASE(MachineTypeAM33, "AM33")
-    PRINT_ENUM_VALUE_CASE(MachineTypePowerPC, "PowerPC")
-    PRINT_ENUM_VALUE_CASE(MachineTypePowerPCFP, "PowerPC FP")
-    PRINT_ENUM_VALUE_CASE(MachineTypeIa64, "IA 64")
-    PRINT_ENUM_VALUE_CASE(MachineTypeMips16, "MIPS 16")
-    PRINT_ENUM_VALUE_CASE(MachineTypeAlpha64, "Alpha 64")
-    PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu, "FPU")
-    PRINT_ENUM_VALUE_CASE(MachineTypeMipsFpu16, "FPU 16")
-    PRINT_ENUM_VALUE_CASE(MachineTypeTriCore, "TriCore")
-    PRINT_ENUM_VALUE_CASE(MachineTypeCEF, "CEF")
-    PRINT_ENUM_VALUE_CASE(MachineTypeEBC, "EBC")
-    PRINT_ENUM_VALUE_CASE(MachineTypeAmd64, "x64")
-    PRINT_ENUM_VALUE_CASE(MachineTypeM32R, "M32R")
-    PRINT_ENUM_VALUE_CASE(MachineTypeCEE, "CEE")
-  }
-  outs() << " {" << llvm::format_hex((DWORD)MachineType, 2, true) << "}";
-  return Stream;
-}
-
-raw_ostream &llvm::operator<<(raw_ostream &Stream, HashAlgorithm Algorithm) {
-  switch (Algorithm) {
-    PRINT_ENUM_VALUE_CASE(HashNone, "None")
-    PRINT_ENUM_VALUE_CASE(HashMD5, "MD5")
-    PRINT_ENUM_VALUE_CASE(HashSHA1, "SHA-1")
-  default:
-    outs() << "(Unknown)";
-    break;
-  }
-  outs() << " {" << (DWORD)Algorithm << "}";
-  return Stream;
-}
diff --git a/tools/llvm-pdbdump/DIAExtras.h b/tools/llvm-pdbdump/DIAExtras.h
deleted file mode 100644 (file)
index aeef197..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-//===- DIAExtras.h - Helper classes and functions for accessing DIA C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Defines helper types, classes, and functions for working with DIA.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
-#define LLVM_TOOLS_LLVMPDBDUMP_DIAEXTRAS_H
-
-#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include "COMExtras.h"
-
-namespace llvm {
-namespace sys {
-namespace windows {
-
-typedef llvm::SmallString<16> DIAString;
-
-template <class T> class DIAResult {
-public:
-  DIAResult() : IsValid(false) {}
-  DIAResult(const T &ResultValue) : Result(ResultValue), IsValid(true) {}
-
-  bool hasValue() const { return IsValid; }
-  T value() const { return Result; }
-
-  void dump(StringRef Name, unsigned IndentLevel) const {
-    if (!hasValue())
-      return;
-    outs().indent(IndentLevel);
-    outs() << Name << ": " << value() << "\n";
-  }
-
-private:
-  T Result;
-  bool IsValid;
-};
-
-template <>
-void DIAResult<BOOL>::dump(StringRef Name, unsigned IndentLevel) const {
-  if (!hasValue())
-    return;
-  outs().indent(IndentLevel);
-  outs() << Name << ": " << (value() ? "true" : "false") << "\n";
-}
-
-template <>
-void DIAResult<GUID>::dump(StringRef Name, unsigned IndentLevel) const {
-  if (!hasValue())
-    return;
-  std::string Guid8;
-  CComBSTR GuidBSTR(value());
-  BSTRToUTF8(GuidBSTR.m_str, Guid8);
-
-  outs().indent(IndentLevel);
-  outs() << Name << ": " << Guid8 << "\n";
-}
-
-// MSDN documents the IDiaSymbol::get_machineType method as returning a value
-// from the CV_CPU_TYPE_e enumeration.  This documentation is wrong, however,
-// and this method actually returns a value from the IMAGE_FILE_xxx set of
-// defines from winnt.h.  These correspond to the platform magic number in
-// the COFF file.  This enumeration is built from the set of values in winnt.h
-enum MachineTypeEnum {
-  MachineTypeUnknown = IMAGE_FILE_MACHINE_UNKNOWN,
-  MachineTypeX86 = IMAGE_FILE_MACHINE_I386,
-  MachineTypeR3000 = IMAGE_FILE_MACHINE_R3000,
-  MachineTypeR4000 = IMAGE_FILE_MACHINE_R4000,
-  MachineTypeR10000 = IMAGE_FILE_MACHINE_R10000,
-  MachineTypeWCEMIPSv2 = IMAGE_FILE_MACHINE_WCEMIPSV2,
-  MachineTypeAlpha = IMAGE_FILE_MACHINE_ALPHA,
-  MachineTypeSH3 = IMAGE_FILE_MACHINE_SH3,
-  MachineTypeSH3DSP = IMAGE_FILE_MACHINE_SH3DSP,
-  MachineTypeSH3E = IMAGE_FILE_MACHINE_SH3E,
-  MachineTypeSH4 = IMAGE_FILE_MACHINE_SH4,
-  MachineTypeSH5 = IMAGE_FILE_MACHINE_SH5,
-  MachineTypeArm = IMAGE_FILE_MACHINE_ARM,
-  MachineTypeThumb = IMAGE_FILE_MACHINE_THUMB,
-  MachineTypeArmNT = IMAGE_FILE_MACHINE_ARMNT,
-  MachineTypeAM33 = IMAGE_FILE_MACHINE_AM33,
-  MachineTypePowerPC = IMAGE_FILE_MACHINE_POWERPC,
-  MachineTypePowerPCFP = IMAGE_FILE_MACHINE_POWERPCFP,
-  MachineTypeIa64 = IMAGE_FILE_MACHINE_IA64,
-  MachineTypeMips16 = IMAGE_FILE_MACHINE_MIPS16,
-  MachineTypeAlpha64 = IMAGE_FILE_MACHINE_ALPHA64,
-  MachineTypeMipsFpu = IMAGE_FILE_MACHINE_MIPSFPU,
-  MachineTypeMipsFpu16 = IMAGE_FILE_MACHINE_MIPSFPU16,
-  MachineTypeTriCore = IMAGE_FILE_MACHINE_TRICORE,
-  MachineTypeCEF = IMAGE_FILE_MACHINE_CEF,
-  MachineTypeEBC = IMAGE_FILE_MACHINE_EBC,
-  MachineTypeAmd64 = IMAGE_FILE_MACHINE_AMD64,
-  MachineTypeM32R = IMAGE_FILE_MACHINE_M32R,
-  MachineTypeCEE = IMAGE_FILE_MACHINE_CEE,
-};
-
-enum HashAlgorithm { HashNone = 0, HashMD5 = 1, HashSHA1 = 2 };
-
-// SymTagEnum has the unfortunate property that it is not only the name of
-// the enum, but also the name of one of the values of the enum.  So that we
-// don't have to always type "enum SymTagEnum", we typedef this to a different
-// name so that we can refer to it more easily.
-typedef enum SymTagEnum DiaSymTagEnum;
-
-typedef CComPtr<IDiaSymbol> DiaSymbolPtr;
-
-} // namespace windows
-} // namespace sys
-} // namespace llvm
-
-namespace llvm {
-class raw_ostream;
-
-raw_ostream &operator<<(raw_ostream &Stream,
-                        llvm::sys::windows::DiaSymTagEnum SymTag);
-raw_ostream &operator<<(raw_ostream &Stream, CV_CPU_TYPE_e CpuType);
-raw_ostream &operator<<(raw_ostream &Stream,
-                        llvm::sys::windows::MachineTypeEnum CpuType);
-raw_ostream &operator<<(raw_ostream &Stream,
-                        llvm::sys::windows::HashAlgorithm Algorithm);
-}
-
-#endif
diff --git a/tools/llvm-pdbdump/DIASymbol.cpp b/tools/llvm-pdbdump/DIASymbol.cpp
deleted file mode 100644 (file)
index 753f6f9..0000000
+++ /dev/null
@@ -1,968 +0,0 @@
-//===- DIASymbol.cpp - Dump debug info from a PDB file ----------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm-pdbdump.h"
-#include "DIASymbol.h"
-
-using namespace llvm::sys::windows;
-
-DIASymbol::DIASymbol(IDiaSymbol *DiaSymbol) : Symbol(DiaSymbol) {
-  Symbol->AddRef();
-}
-
-DIASymbol::~DIASymbol() { Symbol->Release(); }
-
-void DIASymbol::fullDump(int IndentLevel) {
-  getLexicalParent().dump("Lexical parent", IndentLevel);
-  getClassParent().dump("Class parent", IndentLevel);
-  getType().dump("Type", IndentLevel);
-  getArrayIndexType().dump("Array index type", IndentLevel);
-  getVirtualTableShape().dump("Vtable shape", IndentLevel);
-  getLowerBound().dump("Lower bound", IndentLevel);
-  getUpperBound().dump("Upper bound", IndentLevel);
-  getObjectPointerType().dump("Object pointer type", IndentLevel);
-  getContainer().dump("Container", IndentLevel);
-  getVirtualBaseTableType().dump("Virtual base table type", IndentLevel);
-  getUnmodifiedType().dump("Unmodified type", IndentLevel);
-  getSubType().dump("Sub type", IndentLevel);
-  getBaseSymbol().dump("Base symbol", IndentLevel);
-
-#if (_MSC_FULL_VER >= 180031101)
-  // These methods are only available on VS 2013 SP4 and higher.
-  isPGO().dump("Is PGO", IndentLevel);
-  hasValidPGOCounts().dump("Has valid PGO counts", IndentLevel);
-  isOptimizedForSpeed().dump("Is optimized for speed", IndentLevel);
-  getPGOEntryCount().dump("PGO entry count", IndentLevel);
-  getPGOEdgeCount().dump("PGO edge count", IndentLevel);
-  getPGODynamicInstructionCount().dump("PGO dynamic instruction count",
-                                       IndentLevel);
-  getStaticSize().dump("Static size", IndentLevel);
-  getFinalLiveStaticSize().dump("Final live static size", IndentLevel);
-  getPhaseName().dump("Phase name", IndentLevel);
-  hasControlFlowCheck().dump("Has control flow check", IndentLevel);
-#endif
-
-  getAccess().dump("Access", IndentLevel);
-  getAddressOffset().dump("Address Offset", IndentLevel);
-  getAddressSection().dump("Address Section", IndentLevel);
-  getAddressTaken().dump("Address Taken", IndentLevel);
-  getAge().dump("Age", IndentLevel);
-  getArrayIndexTypeId().dump("Array Index Type Id", IndentLevel);
-  getBackEndMajor().dump("Back End Major", IndentLevel);
-  getBackEndMinor().dump("Back End Minor", IndentLevel);
-  getBackEndBuild().dump("Back End Build", IndentLevel);
-  getBaseDataOffset().dump("Base Data Offset", IndentLevel);
-  getBaseDataSlot().dump("Base Data Slot", IndentLevel);
-  getBaseSymbolId().dump("Base Symbol Id", IndentLevel);
-  getBaseType().dump("Base Type", IndentLevel);
-  getBitPosition().dump("Bit Position", IndentLevel);
-  getBuiltInKind().dump("Built In Kind", IndentLevel);
-  getCallingConvention().dump("Calling Convention", IndentLevel);
-  getClassParentId().dump("Class Parent Id", IndentLevel);
-  isCode().dump("Code", IndentLevel);
-  isCompilerGenerated().dump("Compiler Generated", IndentLevel);
-  getCompilerName().dump("Compiler Name", IndentLevel);
-  hasConstructor().dump("Constructor", IndentLevel);
-  isConstType().dump("Const Type", IndentLevel);
-  getCount().dump("Count", IndentLevel);
-  getCountLiveRanges().dump("Count Live Ranges", IndentLevel);
-  hasCustomCallingConvention().dump("Custom Calling Convention", IndentLevel);
-  getDataKind().dump("Data Kind", IndentLevel);
-  isEditAndContinueEnabled().dump("Edit and Continue Enabled", IndentLevel);
-  hasFarReturn().dump("Far Return", IndentLevel);
-  getFrontEndMajor().dump("Front End Major", IndentLevel);
-  getFrontEndMinor().dump("Front End Minor", IndentLevel);
-  getFrontEndBuild().dump("Front End Build", IndentLevel);
-  isFunction().dump("Function", IndentLevel);
-  getGuid().dump("GUID", IndentLevel);
-  hasAlloca().dump("Has Alloca", IndentLevel);
-  hasAssignmentOperator().dump("Has Assignment Operator", IndentLevel);
-  hasCastOperator().dump("Has Cast Operator", IndentLevel);
-  hasDebugInfo().dump("Has Debug Info", IndentLevel);
-  hasEH().dump("Has EH", IndentLevel);
-  hasEHa().dump("Has EHa", IndentLevel);
-  hasInlAsm().dump("Has Inline Asm", IndentLevel);
-  hasLongJump().dump("Has longjmp", IndentLevel);
-  hasManagedCode().dump("Has Managed Code", IndentLevel);
-  hasNestedTypes().dump("Has Nested Types", IndentLevel);
-  hasSecurityChecks().dump("Has Security Checks", IndentLevel);
-  hasSEH().dump("Has SEH", IndentLevel);
-  hasSetJump().dump("Has setjmp", IndentLevel);
-  isIndirectVirtualBaseClass().dump("Is indirect virtual base", IndentLevel);
-  hasInlineAttribute().dump("Has inline declspec", IndentLevel);
-  hasInterruptReturn().dump("Has interrupt return", IndentLevel);
-  isBaseVirtualFunction().dump("Is base virtual function", IndentLevel);
-  isAcceleratorGroupSharedLocal().dump("Is Accelerator Group Shared Local",
-                                       IndentLevel);
-  isAcceleratorPointerTagLiveRange().dump(
-      "Is Accelerator Pointer Tag Live Range", IndentLevel);
-  isAcceleratorStubFunction().dump("Is Accelerator Stub Function", IndentLevel);
-  isAggregated().dump("Is aggregated", IndentLevel);
-  hasCTypes().dump("Has C types", IndentLevel);
-  isCVTCIL().dump("Was converted from MSIL", IndentLevel);
-  isDataAligned().dump("Is data aligned", IndentLevel);
-  isHLSLData().dump("Is HLSL data", IndentLevel);
-  isHotpatchable().dump("Is hot-patchable", IndentLevel);
-  isLTCG().dump("Is LTCG", IndentLevel);
-  isMatrixRowMajor().dump("Is matrix row major", IndentLevel);
-  isMSILNetmodule().dump("Is MSIL .netmodule", IndentLevel);
-  isMultipleInheritance().dump("Is multiple inheritance", IndentLevel);
-  isNaked().dump("Is naked", IndentLevel);
-  isOptimizedAway().dump("Is optimized away", IndentLevel);
-  isPointerBasedOnSymbolValue().dump("Is pointer based on symbol value",
-                                     IndentLevel);
-  isPointerToDataMember().dump("Is pointer to data member", IndentLevel);
-  isPointerToMemberFunction().dump("Is pointer to member function",
-                                   IndentLevel);
-  isReturnValue().dump("Is return value", IndentLevel);
-  isSdl().dump("Is SDL", IndentLevel);
-  isSingleInheritance().dump("Is single inheritance", IndentLevel);
-  isSplitted().dump("Is splitted", IndentLevel);
-  isStatic().dump("Is staic", IndentLevel);
-  isStripped().dump("Is stripped", IndentLevel);
-  isVirtualInheritance().dump("Is virtual inheritance", IndentLevel);
-  getLanguage().dump("Language", IndentLevel);
-  getLength().dump("Length", IndentLevel);
-  getLexicalParentId().dump("Lexical parent id", IndentLevel);
-  getLibraryName().dump("Library name", IndentLevel);
-  getLiveRangeLength().dump("Live range length", IndentLevel);
-  getLiveRangeStartAddressSection().dump("Live range start address section",
-                                         IndentLevel);
-  getLiveRangeStartAddressOffset().dump("Live range start address offset",
-                                        IndentLevel);
-  getLiveRangeStartRelativeVirtualAddress().dump("Live range start address RVA",
-                                                 IndentLevel);
-  getLocationType().dump("Location type", IndentLevel);
-  getLowerBoundId().dump("Lower bound id", IndentLevel);
-  getMachineType().dump("Machine type", IndentLevel);
-  isManagedRef().dump("Managed", IndentLevel);
-  getMemorySpaceKind().dump("Memory space kind", IndentLevel);
-  isMsilRef().dump("MSIL", IndentLevel);
-  getName().dump("Name", IndentLevel);
-  isNested().dump("Nested", IndentLevel);
-  hasNoInlineAttribute().dump("Has noinline declspec", IndentLevel);
-  hasNoReturnAttribute().dump("Has noreturn declspec", IndentLevel);
-  getNoStackOrdering().dump("No stack ordering", IndentLevel);
-  isUnreached().dump("Not reached", IndentLevel);
-  getNumberOfAcceleratorPointerTags().dump("Number of accelerator pointer tags",
-                                           IndentLevel);
-  getNumberOfModifiers().dump("Number of modifiers", IndentLevel);
-  getNumberOfRegisterIndices().dump("Number of register indices", IndentLevel);
-  getNumberOfRows().dump("Number of rows", IndentLevel);
-  getNumberOfColumns().dump("Number of columns", IndentLevel);
-  getObjectFileName().dump("Object file name", IndentLevel);
-  getOemSymbolId().dump("OEM symbol id", IndentLevel);
-  getOffset().dump("Offset", IndentLevel);
-  hasOptimizedCodeDebugInfo().dump("Optimized code debug info", IndentLevel);
-  hasOverloadedOperator().dump("Overloaded operator", IndentLevel);
-  isPacked().dump("Packed", IndentLevel);
-  getPlatform().dump("Platform", IndentLevel);
-  isPureVirtual().dump("Pure", IndentLevel);
-  getRank().dump("Rank", IndentLevel);
-  isReference().dump("Reference", IndentLevel);
-  getRegisterId().dump("Register ID", IndentLevel);
-  getRegisterType().dump("Register type", IndentLevel);
-  getRelativeVirtualAddress().dump("RVA", IndentLevel);
-  isRestrictedType().dump("Restricted type", IndentLevel);
-  getSamplerSlot().dump("Sampler slot", IndentLevel);
-  isScoped().dump("Scoped", IndentLevel);
-  getSignature().dump("Signature", IndentLevel);
-  getSizeInUdt().dump("Size in UDT", IndentLevel);
-  getSlot().dump("Slot", IndentLevel);
-  getSourceFileName().dump("Source file name", IndentLevel);
-  getStride().dump("Stride", IndentLevel);
-  getSubTypeId().dump("Sub type ID", IndentLevel);
-  getSymbolsFileName().dump("File name", IndentLevel);
-  getSymIndexId().dump("Sym index ID", IndentLevel);
-  getSymTag().dump("Sym tag", IndentLevel);
-  getTargetOffset().dump("Target offset", IndentLevel);
-  getTargetRelativeVirtualAddress().dump("Target RVA", IndentLevel);
-  getTargetSection().dump("Target section", IndentLevel);
-  getTargetVirtualAddress().dump("Target virtual address", IndentLevel);
-  getTextureSlot().dump("Texture slot", IndentLevel);
-  getThisAdjust().dump("This adjust", IndentLevel);
-  getThunkOrdinal().dump("Thunk ordinal", IndentLevel);
-  getTimeStamp().dump("Time stamp", IndentLevel);
-  getToken().dump("Token", IndentLevel);
-  getUavSlot().dump("UAV slot", IndentLevel);
-  getUdtKind().dump("UDT kind", IndentLevel);
-  isUnalignedType().dump("Unaligned type", IndentLevel);
-  getUndecoratedName().dump("Undecorated name", IndentLevel);
-  getUnmodifiedTypeId().dump("Unmodified type id", IndentLevel);
-  getUpperBoundId().dump("Upper bound id", IndentLevel);
-  isVirtual().dump("Virtual", IndentLevel);
-  getVirtualAddress().dump("Virtual address", IndentLevel);
-  isVirtualBaseClass().dump("Virtual base class", IndentLevel);
-  getVirtualBaseDispIndex().dump("Virtual base disp index", IndentLevel);
-  getVirtualBaseOffset().dump("Virtual base offset", IndentLevel);
-  getVirtualBasePointerOffset().dump("Virtual base pointer offset",
-                                     IndentLevel);
-  getVirtualTableShapeId().dump("Vtable shape ID", IndentLevel);
-  isVolatileType().dump("Volatile type", IndentLevel);
-}
-
-#if (_MSC_FULL_VER >= 180031101)
-DIAResult<BOOL> DIASymbol::isPGO() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isPGO);
-}
-
-DIAResult<BOOL> DIASymbol::hasValidPGOCounts() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasValidPGOCounts);
-}
-
-DIAResult<BOOL> DIASymbol::isOptimizedForSpeed() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isOptimizedForSpeed);
-}
-
-DIAResult<DWORD> DIASymbol::getPGOEntryCount() {
-  return InternalGetDIAValue(&IDiaSymbol::get_PGOEntryCount);
-}
-
-DIAResult<DWORD> DIASymbol::getPGOEdgeCount() {
-  return InternalGetDIAValue(&IDiaSymbol::get_PGOEdgeCount);
-}
-
-DIAResult<ULONGLONG> DIASymbol::getPGODynamicInstructionCount() {
-  return InternalGetDIAValue(&IDiaSymbol::get_PGODynamicInstructionCount);
-}
-
-DIAResult<DWORD> DIASymbol::getStaticSize() {
-  return InternalGetDIAValue(&IDiaSymbol::get_staticSize);
-}
-
-DIAResult<DWORD> DIASymbol::getFinalLiveStaticSize() {
-  return InternalGetDIAValue(&IDiaSymbol::get_finalLiveStaticSize);
-}
-
-DIAResult<DIAString> DIASymbol::getPhaseName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_phaseName);
-}
-
-DIAResult<BOOL> DIASymbol::hasControlFlowCheck() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasControlFlowCheck);
-}
-#endif
-
-DIAResult<DiaSymbolPtr> DIASymbol::getClassParent() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_classParent);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(&IDiaSymbol::get_type);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getArrayIndexType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_arrayIndexType);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getVirtualTableShape() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_virtualTableShape);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getLowerBound() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_lowerBound);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getUpperBound() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_upperBound);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getObjectPointerType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_objectPointerType);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getContainer() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_container);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getVirtualBaseTableType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_virtualBaseTableType);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getUnmodifiedType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_unmodifiedType);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getSubType() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_subType);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getBaseSymbol() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_baseSymbol);
-}
-
-DIAResult<DWORD> DIASymbol::getAccess() {
-  return InternalGetDIAValue(&IDiaSymbol::get_access);
-}
-
-DIAResult<DWORD> DIASymbol::getAddressOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_addressOffset);
-}
-
-DIAResult<DWORD> DIASymbol::getAddressSection() {
-  return InternalGetDIAValue(&IDiaSymbol::get_addressSection);
-}
-
-DIAResult<BOOL> DIASymbol::getAddressTaken() {
-  return InternalGetDIAValue(&IDiaSymbol::get_addressTaken);
-}
-
-DIAResult<DWORD> DIASymbol::getAge() {
-  return InternalGetDIAValue(&IDiaSymbol::get_age);
-}
-
-DIAResult<DWORD> DIASymbol::getArrayIndexTypeId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_arrayIndexTypeId);
-}
-
-DIAResult<DWORD> DIASymbol::getBackEndMajor() {
-  return InternalGetDIAValue(&IDiaSymbol::get_backEndMajor);
-}
-
-DIAResult<DWORD> DIASymbol::getBackEndMinor() {
-
-  return InternalGetDIAValue(&IDiaSymbol::get_backEndMinor);
-}
-
-DIAResult<DWORD> DIASymbol::getBackEndBuild() {
-  return InternalGetDIAValue(&IDiaSymbol::get_backEndBuild);
-}
-
-DIAResult<DWORD> DIASymbol::getBackEndQFE() {
-  return InternalGetDIAValue(&IDiaSymbol::get_backEndQFE);
-}
-
-DIAResult<DWORD> DIASymbol::getBaseDataOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_baseDataOffset);
-}
-
-DIAResult<DWORD> DIASymbol::getBaseDataSlot() {
-  return InternalGetDIAValue(&IDiaSymbol::get_baseDataSlot);
-}
-
-DIAResult<DWORD> DIASymbol::getBaseSymbolId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_baseSymbolId);
-}
-
-DIAResult<DWORD> DIASymbol::getBaseType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_baseType);
-}
-
-DIAResult<DWORD> DIASymbol::getBitPosition() {
-  return InternalGetDIAValue(&IDiaSymbol::get_bitPosition);
-}
-
-DIAResult<DWORD> DIASymbol::getBuiltInKind() {
-  return InternalGetDIAValue(&IDiaSymbol::get_builtInKind);
-}
-
-DIAResult<CV_call_e> DIASymbol::getCallingConvention() {
-  return InternalGetDIAValue<DWORD, CV_call_e>(
-      &IDiaSymbol::get_callingConvention);
-}
-
-DIAResult<DWORD> DIASymbol::getClassParentId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_classParentId);
-}
-
-DIAResult<BOOL> DIASymbol::isCode() {
-  return InternalGetDIAValue(&IDiaSymbol::get_code);
-}
-
-DIAResult<BOOL> DIASymbol::isCompilerGenerated() {
-  return InternalGetDIAValue(&IDiaSymbol::get_compilerGenerated);
-}
-
-DIAResult<DIAString> DIASymbol::getCompilerName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_compilerName);
-}
-
-DIAResult<BOOL> DIASymbol::hasConstructor() {
-  return InternalGetDIAValue(&IDiaSymbol::get_constructor);
-}
-
-DIAResult<BOOL> DIASymbol::isConstType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_constType);
-}
-
-DIAResult<DWORD> DIASymbol::getCount() {
-  return InternalGetDIAValue(&IDiaSymbol::get_count);
-}
-
-DIAResult<DWORD> DIASymbol::getCountLiveRanges() {
-  return InternalGetDIAValue(&IDiaSymbol::get_countLiveRanges);
-}
-
-DIAResult<BOOL> DIASymbol::hasCustomCallingConvention() {
-  return InternalGetDIAValue(&IDiaSymbol::get_customCallingConvention);
-}
-
-DIAResult<DataKind> DIASymbol::getDataKind() {
-  return InternalGetDIAValue<DWORD, DataKind>(&IDiaSymbol::get_dataKind);
-}
-
-DIAResult<BOOL> DIASymbol::isEditAndContinueEnabled() {
-  return InternalGetDIAValue(&IDiaSymbol::get_editAndContinueEnabled);
-}
-
-DIAResult<BOOL> DIASymbol::hasFarReturn() {
-  return InternalGetDIAValue(&IDiaSymbol::get_farReturn);
-}
-
-DIAResult<DWORD> DIASymbol::getFrontEndMajor() {
-  return InternalGetDIAValue(&IDiaSymbol::get_frontEndMajor);
-}
-
-DIAResult<DWORD> DIASymbol::getFrontEndMinor() {
-  return InternalGetDIAValue(&IDiaSymbol::get_frontEndMinor);
-}
-
-DIAResult<DWORD> DIASymbol::getFrontEndBuild() {
-  return InternalGetDIAValue(&IDiaSymbol::get_frontEndBuild);
-}
-
-DIAResult<DWORD> DIASymbol::getFrontEndQFE() {
-  return InternalGetDIAValue(&IDiaSymbol::get_frontEndQFE);
-}
-
-DIAResult<BOOL> DIASymbol::isFunction() {
-  return InternalGetDIAValue(&IDiaSymbol::get_function);
-}
-
-DIAResult<GUID> DIASymbol::getGuid() {
-  return InternalGetDIAValue(&IDiaSymbol::get_guid);
-}
-
-DIAResult<BOOL> DIASymbol::hasAlloca() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasAlloca);
-}
-
-DIAResult<BOOL> DIASymbol::hasAssignmentOperator() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasAssignmentOperator);
-}
-
-DIAResult<BOOL> DIASymbol::hasCastOperator() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasCastOperator);
-}
-
-DIAResult<BOOL> DIASymbol::hasDebugInfo() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasDebugInfo);
-}
-
-DIAResult<BOOL> DIASymbol::hasEH() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasEH);
-}
-
-DIAResult<BOOL> DIASymbol::hasEHa() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasEHa);
-}
-
-DIAResult<BOOL> DIASymbol::hasInlAsm() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasInlAsm);
-}
-
-DIAResult<BOOL> DIASymbol::hasLongJump() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasLongJump);
-}
-
-DIAResult<BOOL> DIASymbol::hasManagedCode() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasManagedCode);
-}
-
-DIAResult<BOOL> DIASymbol::hasNestedTypes() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasNestedTypes);
-}
-
-DIAResult<BOOL> DIASymbol::hasSecurityChecks() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasSecurityChecks);
-}
-
-DIAResult<BOOL> DIASymbol::hasSEH() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasSEH);
-}
-
-DIAResult<BOOL> DIASymbol::hasSetJump() {
-  return InternalGetDIAValue(&IDiaSymbol::get_hasSetJump);
-}
-
-DIAResult<BOOL> DIASymbol::isIndirectVirtualBaseClass() {
-  return InternalGetDIAValue(&IDiaSymbol::get_indirectVirtualBaseClass);
-}
-
-DIAResult<BOOL> DIASymbol::hasInlineAttribute() {
-  return InternalGetDIAValue(&IDiaSymbol::get_inlSpec);
-}
-
-DIAResult<BOOL> DIASymbol::hasInterruptReturn() {
-  return InternalGetDIAValue(&IDiaSymbol::get_interruptReturn);
-}
-
-DIAResult<BOOL> DIASymbol::isBaseVirtualFunction() {
-  return InternalGetDIAValue(&IDiaSymbol::get_intro);
-}
-
-DIAResult<BOOL> DIASymbol::isIntrinsic() {
-  return InternalGetDIAValue(&IDiaSymbol::get_intrinsic);
-}
-
-DIAResult<BOOL> DIASymbol::isAcceleratorGroupSharedLocal() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isAcceleratorGroupSharedLocal);
-}
-
-DIAResult<BOOL> DIASymbol::isAcceleratorPointerTagLiveRange() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
-}
-
-DIAResult<BOOL> DIASymbol::isAcceleratorStubFunction() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isAcceleratorStubFunction);
-}
-
-DIAResult<BOOL> DIASymbol::isAggregated() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isAggregated);
-}
-
-DIAResult<BOOL> DIASymbol::isConstructorVirtualBase() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isConstructorVirtualBase);
-}
-
-DIAResult<BOOL> DIASymbol::hasStrictGSCheck() {
-  return InternalGetDIAValue(&IDiaSymbol::get_strictGSCheck);
-}
-
-DIAResult<BOOL> DIASymbol::isLocationControlFlowDependent() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isLocationControlFlowDependent);
-}
-
-DIAResult<BOOL> DIASymbol::hasCTypes() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isCTypes);
-}
-
-DIAResult<BOOL> DIASymbol::isCVTCIL() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isCVTCIL);
-}
-
-DIAResult<BOOL> DIASymbol::isDataAligned() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isDataAligned);
-}
-
-DIAResult<BOOL> DIASymbol::isHLSLData() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isHLSLData);
-}
-
-DIAResult<BOOL> DIASymbol::isHotpatchable() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isHotpatchable);
-}
-
-DIAResult<BOOL> DIASymbol::isLTCG() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isLTCG);
-}
-
-DIAResult<BOOL> DIASymbol::isMatrixRowMajor() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isMatrixRowMajor);
-}
-
-DIAResult<BOOL> DIASymbol::isMSILNetmodule() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isMSILNetmodule);
-}
-
-DIAResult<BOOL> DIASymbol::isMultipleInheritance() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isMultipleInheritance);
-}
-
-DIAResult<BOOL> DIASymbol::isNaked() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isNaked);
-}
-
-DIAResult<BOOL> DIASymbol::isOptimizedAway() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isOptimizedAway);
-}
-
-DIAResult<BOOL> DIASymbol::isPointerBasedOnSymbolValue() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isPointerBasedOnSymbolValue);
-}
-
-DIAResult<BOOL> DIASymbol::isPointerToDataMember() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isPointerToDataMember);
-}
-
-DIAResult<BOOL> DIASymbol::isPointerToMemberFunction() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isPointerToMemberFunction);
-}
-
-DIAResult<BOOL> DIASymbol::isReturnValue() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isReturnValue);
-}
-
-DIAResult<BOOL> DIASymbol::isSdl() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isSdl);
-}
-
-DIAResult<BOOL> DIASymbol::isSingleInheritance() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isSingleInheritance);
-}
-
-DIAResult<BOOL> DIASymbol::isSplitted() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isSplitted);
-}
-
-DIAResult<BOOL> DIASymbol::isStatic() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isStatic);
-}
-
-DIAResult<BOOL> DIASymbol::isStripped() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isStripped);
-}
-
-DIAResult<BOOL> DIASymbol::isVirtualInheritance() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isVirtualInheritance);
-}
-
-DIAResult<CV_CFL_LANG> DIASymbol::getLanguage() {
-  return InternalGetDIAValue<DWORD, CV_CFL_LANG>(&IDiaSymbol::get_language);
-}
-
-DIAResult<BOOL> DIASymbol::isSafeBuffers() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isSafeBuffers);
-}
-
-DIAResult<ULONGLONG> DIASymbol::getLength() {
-  return InternalGetDIAValue(&IDiaSymbol::get_length);
-}
-
-DIAResult<DWORD> DIASymbol::getLexicalParentId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_lexicalParentId);
-}
-
-DIAResult<DiaSymbolPtr> DIASymbol::getLexicalParent() {
-  return InternalGetDIAValue<IDiaSymbol *, DiaSymbolPtr>(
-      &IDiaSymbol::get_lexicalParent);
-}
-
-DIAResult<DWORD> DIASymbol::getLocalBasePointerRegisterId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_localBasePointerRegisterId);
-}
-
-DIAResult<DIAString> DIASymbol::getLibraryName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_libraryName);
-}
-
-DIAResult<ULONGLONG> DIASymbol::getLiveRangeLength() {
-  return InternalGetDIAValue(&IDiaSymbol::get_liveRangeLength);
-}
-
-DIAResult<DWORD> DIASymbol::getLiveRangeStartAddressSection() {
-  return InternalGetDIAValue(&IDiaSymbol::get_liveRangeStartAddressSection);
-}
-
-DIAResult<DWORD> DIASymbol::getLiveRangeStartAddressOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_liveRangeStartAddressOffset);
-}
-
-DIAResult<DWORD> DIASymbol::getLiveRangeStartRelativeVirtualAddress() {
-  return InternalGetDIAValue(
-      &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
-}
-
-DIAResult<LocationType> DIASymbol::getLocationType() {
-  return InternalGetDIAValue<DWORD, LocationType>(
-      &IDiaSymbol::get_locationType);
-}
-
-DIAResult<DWORD> DIASymbol::getLowerBoundId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_lowerBoundId);
-}
-
-DIAResult<MachineTypeEnum> DIASymbol::getMachineType() {
-  return InternalGetDIAValue<DWORD, MachineTypeEnum>(
-      &IDiaSymbol::get_machineType);
-}
-
-DIAResult<BOOL> DIASymbol::isManagedRef() {
-  return InternalGetDIAValue(&IDiaSymbol::get_managed);
-}
-
-DIAResult<DWORD> DIASymbol::getMemorySpaceKind() {
-  return InternalGetDIAValue(&IDiaSymbol::get_memorySpaceKind);
-}
-
-DIAResult<BOOL> DIASymbol::isMsilRef() {
-  return InternalGetDIAValue(&IDiaSymbol::get_msil);
-}
-
-DIAResult<DIAString> DIASymbol::getName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_name);
-}
-
-DIAResult<BOOL> DIASymbol::isNested() {
-  return InternalGetDIAValue(&IDiaSymbol::get_nested);
-}
-
-DIAResult<BOOL> DIASymbol::hasNoInlineAttribute() {
-  return InternalGetDIAValue(&IDiaSymbol::get_noInline);
-}
-
-DIAResult<BOOL> DIASymbol::hasNoReturnAttribute() {
-  return InternalGetDIAValue(&IDiaSymbol::get_noReturn);
-}
-
-DIAResult<BOOL> DIASymbol::getNoStackOrdering() {
-  return InternalGetDIAValue(&IDiaSymbol::get_noStackOrdering);
-}
-
-DIAResult<BOOL> DIASymbol::isUnreached() {
-  return InternalGetDIAValue(&IDiaSymbol::get_notReached);
-}
-
-DIAResult<DWORD> DIASymbol::getNumberOfAcceleratorPointerTags() {
-  return InternalGetDIAValue(&IDiaSymbol::get_numberOfAcceleratorPointerTags);
-}
-
-DIAResult<DWORD> DIASymbol::getNumberOfModifiers() {
-  return InternalGetDIAValue(&IDiaSymbol::get_numberOfModifiers);
-}
-
-DIAResult<DWORD> DIASymbol::getNumberOfRegisterIndices() {
-  return InternalGetDIAValue(&IDiaSymbol::get_numberOfRegisterIndices);
-}
-
-DIAResult<DWORD> DIASymbol::getNumberOfRows() {
-  return InternalGetDIAValue(&IDiaSymbol::get_numberOfRows);
-}
-
-DIAResult<DWORD> DIASymbol::getNumberOfColumns() {
-  return InternalGetDIAValue(&IDiaSymbol::get_numberOfColumns);
-}
-
-DIAResult<DIAString> DIASymbol::getObjectFileName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_objectFileName);
-}
-
-DIAResult<DWORD> DIASymbol::getOemSymbolId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_oemSymbolId);
-}
-
-DIAResult<LONG> DIASymbol::getOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_offset);
-}
-
-DIAResult<DWORD> DIASymbol::getOffsetInUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_offsetInUdt);
-}
-
-DIAResult<BOOL> DIASymbol::hasOptimizedCodeDebugInfo() {
-  return InternalGetDIAValue(&IDiaSymbol::get_optimizedCodeDebugInfo);
-}
-
-DIAResult<BOOL> DIASymbol::hasOverloadedOperator() {
-  return InternalGetDIAValue(&IDiaSymbol::get_overloadedOperator);
-}
-
-DIAResult<BOOL> DIASymbol::isPacked() {
-  return InternalGetDIAValue(&IDiaSymbol::get_packed);
-}
-
-DIAResult<CV_CPU_TYPE_e> DIASymbol::getPlatform() {
-  return InternalGetDIAValue<DWORD, CV_CPU_TYPE_e>(&IDiaSymbol::get_platform);
-}
-
-DIAResult<BOOL> DIASymbol::isPureVirtual() {
-  return InternalGetDIAValue(&IDiaSymbol::get_pure);
-}
-
-DIAResult<DWORD> DIASymbol::getRank() {
-  return InternalGetDIAValue(&IDiaSymbol::get_rank);
-}
-
-DIAResult<BOOL> DIASymbol::isReference() {
-  return InternalGetDIAValue(&IDiaSymbol::get_reference);
-}
-
-DIAResult<BOOL> DIASymbol::isRValueReference() {
-  return InternalGetDIAValue(&IDiaSymbol::get_RValueReference);
-}
-
-DIAResult<DWORD> DIASymbol::getRegisterId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_registerId);
-}
-
-DIAResult<DWORD> DIASymbol::getRegisterType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_registerType);
-}
-
-DIAResult<DWORD> DIASymbol::getRelativeVirtualAddress() {
-  return InternalGetDIAValue(&IDiaSymbol::get_relativeVirtualAddress);
-}
-
-DIAResult<BOOL> DIASymbol::isRestrictedType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_restrictedType);
-}
-
-DIAResult<DWORD> DIASymbol::getSamplerSlot() {
-  return InternalGetDIAValue(&IDiaSymbol::get_samplerSlot);
-}
-
-DIAResult<BOOL> DIASymbol::isScoped() {
-  return InternalGetDIAValue(&IDiaSymbol::get_scoped);
-}
-
-DIAResult<BOOL> DIASymbol::isRefUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isRefUdt);
-}
-
-DIAResult<BOOL> DIASymbol::isValueUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isValueUdt);
-}
-
-DIAResult<BOOL> DIASymbol::isInterfaceUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isInterfaceUdt);
-}
-
-DIAResult<BOOL> DIASymbol::isCxxReturnUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_isCxxReturnUdt);
-}
-
-DIAResult<DWORD> DIASymbol::getSignature() {
-  return InternalGetDIAValue(&IDiaSymbol::get_signature);
-}
-
-DIAResult<DWORD> DIASymbol::getSizeInUdt() {
-  return InternalGetDIAValue(&IDiaSymbol::get_sizeInUdt);
-}
-
-DIAResult<DWORD> DIASymbol::getSlot() {
-  return InternalGetDIAValue(&IDiaSymbol::get_slot);
-}
-
-DIAResult<DIAString> DIASymbol::getSourceFileName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_sourceFileName);
-}
-
-DIAResult<DWORD> DIASymbol::getStride() {
-  return InternalGetDIAValue(&IDiaSymbol::get_stride);
-}
-
-DIAResult<DWORD> DIASymbol::getSubTypeId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_subTypeId);
-}
-
-DIAResult<DIAString> DIASymbol::getSymbolsFileName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_symbolsFileName);
-}
-
-DIAResult<DWORD> DIASymbol::getSymIndexId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_symIndexId);
-}
-
-DIAResult<DiaSymTagEnum> DIASymbol::getSymTag() {
-  return InternalGetDIAValue<DWORD, DiaSymTagEnum>(&IDiaSymbol::get_symTag);
-}
-
-DIAResult<DWORD> DIASymbol::getTargetOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_targetOffset);
-}
-
-DIAResult<DWORD> DIASymbol::getTargetRelativeVirtualAddress() {
-  return InternalGetDIAValue(&IDiaSymbol::get_targetRelativeVirtualAddress);
-}
-
-DIAResult<DWORD> DIASymbol::getTargetSection() {
-  return InternalGetDIAValue(&IDiaSymbol::get_targetSection);
-}
-
-DIAResult<ULONGLONG> DIASymbol::getTargetVirtualAddress() {
-  return InternalGetDIAValue(&IDiaSymbol::get_targetVirtualAddress);
-}
-
-DIAResult<DWORD> DIASymbol::getTextureSlot() {
-  return InternalGetDIAValue(&IDiaSymbol::get_textureSlot);
-}
-
-DIAResult<LONG> DIASymbol::getThisAdjust() {
-  return InternalGetDIAValue(&IDiaSymbol::get_thisAdjust);
-}
-
-DIAResult<THUNK_ORDINAL> DIASymbol::getThunkOrdinal() {
-  return InternalGetDIAValue<DWORD, THUNK_ORDINAL>(
-      &IDiaSymbol::get_thunkOrdinal);
-}
-
-DIAResult<DWORD> DIASymbol::getTimeStamp() {
-  return InternalGetDIAValue(&IDiaSymbol::get_timeStamp);
-}
-
-DIAResult<DWORD> DIASymbol::getToken() {
-  return InternalGetDIAValue(&IDiaSymbol::get_token);
-}
-
-DIAResult<DWORD> DIASymbol::getUavSlot() {
-  return InternalGetDIAValue(&IDiaSymbol::get_uavSlot);
-}
-
-DIAResult<UdtKind> DIASymbol::getUdtKind() {
-  return InternalGetDIAValue<DWORD, UdtKind>(&IDiaSymbol::get_udtKind);
-}
-
-DIAResult<BOOL> DIASymbol::isUnalignedType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_unalignedType);
-}
-
-DIAResult<DIAString> DIASymbol::getUndecoratedName() {
-  return InternalGetDIAStringValue(&IDiaSymbol::get_undecoratedName);
-}
-
-DIAResult<DWORD> DIASymbol::getUnmodifiedTypeId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_unmodifiedTypeId);
-}
-
-DIAResult<DWORD> DIASymbol::getUpperBoundId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_upperBoundId);
-}
-
-DIAResult<BOOL> DIASymbol::isVirtual() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtual);
-}
-
-DIAResult<ULONGLONG> DIASymbol::getVirtualAddress() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualAddress);
-}
-
-DIAResult<BOOL> DIASymbol::isVirtualBaseClass() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualBaseClass);
-}
-
-DIAResult<DWORD> DIASymbol::getVirtualBaseDispIndex() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualBaseDispIndex);
-}
-
-DIAResult<DWORD> DIASymbol::getVirtualBaseOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualBaseOffset);
-}
-
-DIAResult<LONG> DIASymbol::getVirtualBasePointerOffset() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualBasePointerOffset);
-}
-
-DIAResult<DWORD> DIASymbol::getVirtualTableShapeId() {
-  return InternalGetDIAValue(&IDiaSymbol::get_virtualTableShapeId);
-}
-
-DIAResult<BOOL> DIASymbol::isVolatileType() {
-  return InternalGetDIAValue(&IDiaSymbol::get_volatileType);
-}
diff --git a/tools/llvm-pdbdump/DIASymbol.h b/tools/llvm-pdbdump/DIASymbol.h
deleted file mode 100644 (file)
index 3e908e1..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-//===- DIASymbol.h - Dump debug info from a PDB file ------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Provides a wrapper around the IDiaSymbol interface.  IDiaSymbol is used to
-// represent any kind of symbol from functions, to compilands, to source files.
-// It provides a monolithic interface of close to 200 operations, and the set
-// of operations that are valid depends on the type of the symbol.  Since it is
-// not clearly documented which set of operations is valid for which type of
-// symbol, the best way of figuring it out is to dump every method for every
-// symbol, and see which methods return errors.  This wrapper provides a clean
-// way of doing this without involving needing to embed lots of unsightly
-// HRESULT checking at every callsite.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
-#define LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
-
-#include "DIAExtras.h"
-#include "llvm/ADT/SmallString.h"
-
-namespace llvm {
-namespace sys {
-namespace windows {
-
-class DIASymbol {
-public:
-  DIASymbol(IDiaSymbol *DiaSymbol);
-  ~DIASymbol();
-
-  /// Dumps the value of every property (if it exists) with a default name.
-  /// This is useful for understanding what symbol types support what methods
-  /// during development time.
-  void fullDump(int IndentLevel);
-
-// TODO: The following methods are present on IDiaSymbol but do not yet have
-// wrapper methods.
-//
-// HRESULT get_value(VARIANT *pRetVal) = 0;
-// HRESULT get_undecoratedNameEx(DWORD undecorateOptions, BSTR *name) = 0;
-// HRESULT getSrcLineOnTypeDefn(IDiaLineNumber **ppResult) = 0;
-// HRESULT get_dataBytes(DWORD cbData, DWORD *pcbData, BYTE *pbData) = 0;
-// HRESULT get_types(DWORD cTypes, DWORD *pcTypes, IDiaSymbol **pTypes) = 0;
-// HRESULT get_typeIds(DWORD cTypeIds, DWORD *pcTypeIds, DWORD *pdwTypeIds) = 0;
-// HRESULT get_numericProperties(DWORD cnt, DWORD *pcnt,
-//                               DWORD *pProperties) = 0;
-// HRESULT get_modifierValues(DWORD cnt, DWORD *pcnt, WORD *pModifiers) = 0;
-// HRESULT get_acceleratorPointerTags(DWORD cnt, DWORD *pcnt, DWORD
-//                                    *pPointerTags) = 0;
-// HRESULT get_hfaFloat(BOOL *pRetVal) = 0;
-// HRESULT get_hfaDouble(BOOL *pRetVal) = 0;
-// HRESULT get_paramBasePointerRegisterId(DWORD *pRetVal) = 0;
-// HRESULT get_isWinRTPointer(BOOL *pRetVal) = 0;
-
-#if (_MSC_FULL_VER >= 180031101)
-  // These methods are only available on VS 2013 SP 4 and higher.
-  DIAResult<BOOL> isPGO();
-  DIAResult<BOOL> hasValidPGOCounts();
-  DIAResult<BOOL> isOptimizedForSpeed();
-  DIAResult<DWORD> getPGOEntryCount();
-  DIAResult<DWORD> getPGOEdgeCount();
-  DIAResult<ULONGLONG> getPGODynamicInstructionCount();
-  DIAResult<DWORD> getStaticSize();
-  DIAResult<DWORD> getFinalLiveStaticSize();
-  DIAResult<DIAString> getPhaseName();
-  DIAResult<BOOL> hasControlFlowCheck();
-#endif
-
-  DIAResult<DiaSymbolPtr> getLexicalParent();
-  DIAResult<DiaSymbolPtr> getClassParent();
-  DIAResult<DiaSymbolPtr> getType();
-  DIAResult<DiaSymbolPtr> getArrayIndexType();
-  DIAResult<DiaSymbolPtr> getVirtualTableShape();
-  DIAResult<DiaSymbolPtr> getLowerBound();
-  DIAResult<DiaSymbolPtr> getUpperBound();
-  DIAResult<DiaSymbolPtr> getObjectPointerType();
-  DIAResult<DiaSymbolPtr> getContainer();
-  DIAResult<DiaSymbolPtr> getVirtualBaseTableType();
-  DIAResult<DiaSymbolPtr> getUnmodifiedType();
-  DIAResult<DiaSymbolPtr> getSubType();
-  DIAResult<DiaSymbolPtr> getBaseSymbol();
-
-  DIAResult<DWORD> getAccess();
-  DIAResult<DWORD> getAddressOffset();
-  DIAResult<DWORD> getAddressSection();
-  DIAResult<DWORD> getAge();
-  DIAResult<DWORD> getArrayIndexTypeId();
-  DIAResult<DWORD> getBackEndBuild();
-  DIAResult<DWORD> getBackEndMajor();
-  DIAResult<DWORD> getBackEndMinor();
-  DIAResult<DWORD> getBackEndQFE();
-  DIAResult<DWORD> getBaseDataOffset();
-  DIAResult<DWORD> getBaseDataSlot();
-  DIAResult<DWORD> getBaseSymbolId();
-  DIAResult<DWORD> getBaseType();
-  DIAResult<DWORD> getBitPosition();
-  DIAResult<DWORD> getBuiltInKind();
-  DIAResult<CV_call_e> getCallingConvention();
-  DIAResult<DWORD> getClassParentId();
-  DIAResult<DIAString> getCompilerName();
-  DIAResult<DWORD> getCount();
-  DIAResult<DWORD> getCountLiveRanges();
-  DIAResult<DWORD> getFrontEndBuild();
-  DIAResult<DWORD> getFrontEndMajor();
-  DIAResult<DWORD> getFrontEndMinor();
-  DIAResult<DWORD> getFrontEndQFE();
-  DIAResult<CV_CFL_LANG> getLanguage();
-  DIAResult<DWORD> getLexicalParentId();
-  DIAResult<DIAString> getLibraryName();
-  DIAResult<DWORD> getLiveRangeStartAddressOffset();
-  DIAResult<DWORD> getLiveRangeStartAddressSection();
-  DIAResult<DWORD> getLiveRangeStartRelativeVirtualAddress();
-  DIAResult<DWORD> getLocalBasePointerRegisterId();
-  DIAResult<DWORD> getLowerBoundId();
-  DIAResult<DWORD> getMemorySpaceKind();
-  DIAResult<DIAString> getName();
-  DIAResult<DWORD> getNumberOfAcceleratorPointerTags();
-  DIAResult<DWORD> getNumberOfColumns();
-  DIAResult<DWORD> getNumberOfModifiers();
-  DIAResult<DWORD> getNumberOfRegisterIndices();
-  DIAResult<DWORD> getNumberOfRows();
-  DIAResult<DIAString> getObjectFileName();
-  DIAResult<DWORD> getOemSymbolId();
-  DIAResult<DWORD> getOffsetInUdt();
-  DIAResult<CV_CPU_TYPE_e> getPlatform();
-  DIAResult<DWORD> getRank();
-  DIAResult<DWORD> getRegisterId();
-  DIAResult<DWORD> getRegisterType();
-  DIAResult<DWORD> getRelativeVirtualAddress();
-  DIAResult<DWORD> getSamplerSlot();
-  DIAResult<DWORD> getSignature();
-  DIAResult<DWORD> getSizeInUdt();
-  DIAResult<DWORD> getSlot();
-  DIAResult<DIAString> getSourceFileName();
-  DIAResult<DWORD> getStride();
-  DIAResult<DWORD> getSubTypeId();
-  DIAResult<DIAString> getSymbolsFileName();
-  DIAResult<DWORD> getSymIndexId();
-  DIAResult<DWORD> getTargetOffset();
-  DIAResult<DWORD> getTargetRelativeVirtualAddress();
-  DIAResult<DWORD> getTargetSection();
-  DIAResult<DWORD> getTextureSlot();
-  DIAResult<DWORD> getTimeStamp();
-  DIAResult<DWORD> getToken();
-  DIAResult<DWORD> getUavSlot();
-  DIAResult<DIAString> getUndecoratedName();
-  DIAResult<DWORD> getUnmodifiedTypeId();
-  DIAResult<DWORD> getUpperBoundId();
-  DIAResult<DWORD> getVirtualBaseDispIndex();
-  DIAResult<DWORD> getVirtualBaseOffset();
-  DIAResult<DWORD> getVirtualTableShapeId();
-  DIAResult<DataKind> getDataKind();
-  DIAResult<DiaSymTagEnum> getSymTag();
-  DIAResult<GUID> getGuid();
-  DIAResult<LONG> getOffset();
-  DIAResult<LONG> getThisAdjust();
-  DIAResult<LONG> getVirtualBasePointerOffset();
-  DIAResult<LocationType> getLocationType();
-  DIAResult<MachineTypeEnum> getMachineType();
-  DIAResult<THUNK_ORDINAL> getThunkOrdinal();
-  DIAResult<ULONGLONG> getLength();
-  DIAResult<ULONGLONG> getLiveRangeLength();
-  DIAResult<ULONGLONG> getTargetVirtualAddress();
-  DIAResult<ULONGLONG> getVirtualAddress();
-  DIAResult<UdtKind> getUdtKind();
-  DIAResult<BOOL> hasConstructor();
-  DIAResult<BOOL> hasCustomCallingConvention();
-  DIAResult<BOOL> hasFarReturn();
-  DIAResult<BOOL> isCode();
-  DIAResult<BOOL> isCompilerGenerated();
-  DIAResult<BOOL> isConstType();
-  DIAResult<BOOL> isEditAndContinueEnabled();
-  DIAResult<BOOL> isFunction();
-  DIAResult<BOOL> getAddressTaken();
-  DIAResult<BOOL> getNoStackOrdering();
-  DIAResult<BOOL> hasAlloca();
-  DIAResult<BOOL> hasAssignmentOperator();
-  DIAResult<BOOL> hasCTypes();
-  DIAResult<BOOL> hasCastOperator();
-  DIAResult<BOOL> hasDebugInfo();
-  DIAResult<BOOL> hasEH();
-  DIAResult<BOOL> hasEHa();
-  DIAResult<BOOL> hasInlAsm();
-  DIAResult<BOOL> hasInlineAttribute();
-  DIAResult<BOOL> hasInterruptReturn();
-  DIAResult<BOOL> hasLongJump();
-  DIAResult<BOOL> hasManagedCode();
-  DIAResult<BOOL> hasNestedTypes();
-  DIAResult<BOOL> hasNoInlineAttribute();
-  DIAResult<BOOL> hasNoReturnAttribute();
-  DIAResult<BOOL> hasOptimizedCodeDebugInfo();
-  DIAResult<BOOL> hasOverloadedOperator();
-  DIAResult<BOOL> hasSEH();
-  DIAResult<BOOL> hasSecurityChecks();
-  DIAResult<BOOL> hasSetJump();
-  DIAResult<BOOL> hasStrictGSCheck();
-  DIAResult<BOOL> isAcceleratorGroupSharedLocal();
-  DIAResult<BOOL> isAcceleratorPointerTagLiveRange();
-  DIAResult<BOOL> isAcceleratorStubFunction();
-  DIAResult<BOOL> isAggregated();
-  DIAResult<BOOL> isBaseVirtualFunction();
-  DIAResult<BOOL> isCVTCIL();
-  DIAResult<BOOL> isConstructorVirtualBase();
-  DIAResult<BOOL> isCxxReturnUdt();
-  DIAResult<BOOL> isDataAligned();
-  DIAResult<BOOL> isHLSLData();
-  DIAResult<BOOL> isHotpatchable();
-  DIAResult<BOOL> isIndirectVirtualBaseClass();
-  DIAResult<BOOL> isInterfaceUdt();
-  DIAResult<BOOL> isIntrinsic();
-  DIAResult<BOOL> isLTCG();
-  DIAResult<BOOL> isLocationControlFlowDependent();
-  DIAResult<BOOL> isMSILNetmodule();
-  DIAResult<BOOL> isManagedRef();
-  DIAResult<BOOL> isMatrixRowMajor();
-  DIAResult<BOOL> isMsilRef();
-  DIAResult<BOOL> isMultipleInheritance();
-  DIAResult<BOOL> isNaked();
-  DIAResult<BOOL> isNested();
-  DIAResult<BOOL> isOptimizedAway();
-  DIAResult<BOOL> isPacked();
-  DIAResult<BOOL> isPointerBasedOnSymbolValue();
-  DIAResult<BOOL> isPointerToDataMember();
-  DIAResult<BOOL> isPointerToMemberFunction();
-  DIAResult<BOOL> isPureVirtual();
-  DIAResult<BOOL> isRValueReference();
-  DIAResult<BOOL> isRefUdt();
-  DIAResult<BOOL> isReference();
-  DIAResult<BOOL> isRestrictedType();
-  DIAResult<BOOL> isReturnValue();
-  DIAResult<BOOL> isSafeBuffers();
-  DIAResult<BOOL> isScoped();
-  DIAResult<BOOL> isSdl();
-  DIAResult<BOOL> isSingleInheritance();
-  DIAResult<BOOL> isSplitted();
-  DIAResult<BOOL> isStatic();
-  DIAResult<BOOL> isStripped();
-  DIAResult<BOOL> isUnalignedType();
-  DIAResult<BOOL> isUnreached();
-  DIAResult<BOOL> isValueUdt();
-  DIAResult<BOOL> isVirtual();
-  DIAResult<BOOL> isVirtualBaseClass();
-  DIAResult<BOOL> isVirtualInheritance();
-  DIAResult<BOOL> isVolatileType();
-
-private:
-  template <class T, class U = T>
-  DIAResult<U>
-  InternalGetDIAValue(HRESULT (__stdcall IDiaSymbol::*Method)(T *)) {
-    T Value;
-    if (S_OK == (Symbol->*Method)(&Value))
-      return DIAResult<U>(U(Value));
-    else
-      return DIAResult<U>();
-  }
-
-  DIAResult<DIAString>
-  InternalGetDIAStringValue(HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
-    BSTR String16;
-    if (S_OK == (Symbol->*Method)(&String16)) {
-      std::string String8;
-      llvm::sys::windows::BSTRToUTF8(String16, String8);
-      SysFreeString(String16);
-      return DIAResult<DIAString>(DIAString(String8));
-    } else
-      return DIAResult<DIAString>();
-  }
-
-  IDiaSymbol *Symbol;
-};
-
-} // namespace windows
-} // namespace sys
-} // namespace llvm
-
-#endif
index 29d40debd6b2617dd1fbfd41e387d77c9eda1b61..487768935dddcfce497cc663e4e8c0c696f7ee7f 100644 (file)
@@ -19,5 +19,5 @@
 type = Tool
 name = llvm-pdbdump
 parent = Tools
-required_libraries = 
+required_libraries = DebugInfoPDB
 
diff --git a/tools/llvm-pdbdump/Makefile b/tools/llvm-pdbdump/Makefile
new file mode 100644 (file)
index 0000000..18aafc4
--- /dev/null
@@ -0,0 +1,17 @@
+##===- tools/llvm-pdbdump/Makefile -------------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL := ../..
+TOOLNAME := llvm-pdbdump
+LINK_COMPONENTS := DebugInfoPDB Object
+
+# This tool has no plugins, optimize startup time.
+TOOL_NO_EXPORTS := 1
+
+include $(LEVEL)/Makefile.common
index 2c5109888bcc2bd5d7ab129f31a08e854b6a9cae..e2db7f6daf97311119713e3e0631b408589abf0c 100644 (file)
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/DebugInfo/PDB/PDB.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 
-#include "llvm-pdbdump.h"
-#include "COMExtras.h"
-#include "DIAExtras.h"
-#include "DIASymbol.h"
+#include <Windows.h>
 
 using namespace llvm;
-using namespace llvm::sys::windows;
 
 namespace opts {
 cl::list<std::string> InputFilenames(cl::Positional,
                                      cl::desc("<input PDB files>"),
                                      cl::OneOrMore);
 
-cl::opt<bool> Streams("streams", cl::desc("Display data stream information"));
-cl::alias StreamsShort("x", cl::desc("Alias for --streams"),
-                       cl::aliasopt(Streams));
-
-cl::opt<bool> StreamData("stream-data",
-                         cl::desc("Dumps stream record data as bytes"));
-cl::alias StreamDataShort("X", cl::desc("Alias for --stream-data"),
-                          cl::aliasopt(StreamData));
-
-cl::opt<bool> Tables("tables",
-                     cl::desc("Display summary information for all of the "
-                              "debug tables in the input file"));
-cl::alias TablesShort("t", cl::desc("Alias for --tables"),
-                      cl::aliasopt(Tables));
-
-cl::opt<bool> SourceFiles("source-files",
-                          cl::desc("Display a list of the source files "
-                                   "contained in the PDB"));
-cl::alias SourceFilesShort("f", cl::desc("Alias for --source-files"),
-                           cl::aliasopt(SourceFiles));
-
 cl::opt<bool> Compilands("compilands",
                          cl::desc("Display a list of compilands (e.g. object "
-                                  "files) and their source file composition"));
+                                  "files) and symbols for each one."));
 cl::alias CompilandsShort("c", cl::desc("Alias for --compilands"),
                           cl::aliasopt(Compilands));
-
-cl::opt<bool> Symbols("symbols", cl::desc("Display symbols"));
-cl::alias SymbolsShort("s", cl::desc("Alias for --symbols"),
-                       cl::aliasopt(Symbols));
-
-cl::opt<bool> SymbolDetails("symbol-details",
-                            cl::desc("Display symbol details"));
-cl::alias SymbolDetailsShort("S", cl::desc("Alias for --symbol-details"),
-                             cl::aliasopt(SymbolDetails));
-}
-
-template <typename TableType>
-static HRESULT getDIATable(IDiaSession *Session, TableType **Table) {
-  CComPtr<IDiaEnumTables> EnumTables = nullptr;
-  HRESULT Error = S_OK;
-  if (FAILED(Error = Session->getEnumTables(&EnumTables)))
-    return Error;
-
-  for (auto CurTable : make_com_enumerator(EnumTables)) {
-    TableType *ResultTable = nullptr;
-    if (FAILED(CurTable->QueryInterface(
-            __uuidof(TableType), reinterpret_cast<void **>(&ResultTable))))
-      continue;
-
-    *Table = ResultTable;
-    return S_OK;
-  }
-  return E_FAIL;
-}
-
-static void dumpBasicFileInfo(StringRef Path, IDiaSession *Session) {
-  CComPtr<IDiaSymbol> GlobalScope;
-  HRESULT hr = Session->get_globalScope(&GlobalScope);
-  DIASymbol GlobalScopeSymbol(GlobalScope);
-  if (S_OK == hr)
-    GlobalScopeSymbol.getSymbolsFileName().dump("File", 0);
-  else
-    outs() << "File: " << Path << "\n";
-  HANDLE FileHandle = ::CreateFile(
-      Path.data(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr,
-      OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
-  LARGE_INTEGER FileSize;
-  if (INVALID_HANDLE_VALUE != FileHandle) {
-    outs().indent(2);
-    if (::GetFileSizeEx(FileHandle, &FileSize))
-      outs() << "Size: " << FileSize.QuadPart << " bytes\n";
-    else
-      outs() << "Size: (Unable to obtain file size)\n";
-    FILETIME ModifiedTime;
-    outs().indent(2);
-    if (::GetFileTime(FileHandle, nullptr, nullptr, &ModifiedTime)) {
-      ULARGE_INTEGER TimeInteger;
-      TimeInteger.LowPart = ModifiedTime.dwLowDateTime;
-      TimeInteger.HighPart = ModifiedTime.dwHighDateTime;
-      llvm::sys::TimeValue Time;
-      Time.fromWin32Time(TimeInteger.QuadPart);
-      outs() << "Timestamp: " << Time.str() << "\n";
-    } else {
-      outs() << "Timestamp: (Unable to obtain time stamp)\n";
-    }
-    ::CloseHandle(FileHandle);
-  }
-
-  if (S_OK == hr)
-    GlobalScopeSymbol.fullDump(2);
-  outs() << "\n";
-  outs().flush();
 }
 
-static void dumpDataStreams(IDiaSession *Session) {
-  CComPtr<IDiaEnumDebugStreams> DebugStreams = nullptr;
-  if (FAILED(Session->getEnumDebugStreams(&DebugStreams)))
-    return;
-
-  LONG Count = 0;
-  if (FAILED(DebugStreams->get_Count(&Count)))
+static void dumpInput(StringRef Path) {
+  std::unique_ptr<IPDBSession> Session(
+      llvm::createPDBReader(PDB_ReaderType::DIA, Path));
+  if (!Session) {
+    outs() << "Unable to create PDB reader.  Check that a valid implementation";
+    outs() << " is available for your platform.";
     return;
-  outs() << "Data Streams [count=" << Count << "]\n";
-
-  std::string Name8;
-
-  for (auto Stream : make_com_enumerator(DebugStreams)) {
-    BSTR Name16;
-    if (FAILED(Stream->get_name(&Name16)))
-      continue;
-    if (BSTRToUTF8(Name16, Name8))
-      outs() << "  " << Name8;
-    ::SysFreeString(Name16);
-    if (FAILED(Stream->get_Count(&Count))) {
-      outs() << "\n";
-      continue;
-    }
-
-    outs() << " [" << Count << " records]\n";
-    if (opts::StreamData) {
-      int RecordIndex = 0;
-      for (auto StreamRecord : make_com_data_record_enumerator(Stream)) {
-        outs() << "    Record " << RecordIndex << " [" << StreamRecord.size()
-               << " bytes]";
-        for (uint8_t byte : StreamRecord) {
-          outs() << " " << llvm::format_hex_no_prefix(byte, 2, true);
-        }
-        outs() << "\n";
-        ++RecordIndex;
-      }
-    }
   }
-  outs() << "\n";
-  outs().flush();
-}
-
-static void dumpDebugTables(IDiaSession *Session) {
-  CComPtr<IDiaEnumTables> EnumTables = nullptr;
-  if (SUCCEEDED(Session->getEnumTables(&EnumTables))) {
-    LONG Count = 0;
-    if (FAILED(EnumTables->get_Count(&Count)))
-      return;
-
-    outs() << "Debug Tables [count=" << Count << "]\n";
 
-    std::string Name8;
-    for (auto Table : make_com_enumerator(EnumTables)) {
-      BSTR Name16;
-      if (FAILED(Table->get_name(&Name16)))
-        continue;
-      if (BSTRToUTF8(Name16, Name8))
-        outs() << "  " << Name8;
-      ::SysFreeString(Name16);
-      if (SUCCEEDED(Table->get_Count(&Count))) {
-        outs() << " [" << Count << " items]\n";
-      } else
-        outs() << "\n";
-    }
-  }
-  outs() << "\n";
-  outs().flush();
-}
-
-static void dumpSourceFiles(IDiaSession *Session) {
-  CComPtr<IDiaEnumSourceFiles> EnumSourceFileList;
-  if (FAILED(getDIATable(Session, &EnumSourceFileList)))
-    return;
-
-  LONG SourceFileCount = 0;
-  EnumSourceFileList->get_Count(&SourceFileCount);
-
-  outs() << "Dumping source files [" << SourceFileCount << " files]\n";
-  for (auto SourceFile : make_com_enumerator(EnumSourceFileList)) {
-    CComBSTR SourceFileName;
-    if (S_OK != SourceFile->get_fileName(&SourceFileName))
-      continue;
-    outs().indent(2);
-    std::string SourceFileName8;
-    BSTRToUTF8(SourceFileName, SourceFileName8);
-    outs() << SourceFileName8 << "\n";
-  }
-  outs() << "\n";
+  auto GlobalScope(Session->getGlobalScope());
+  GlobalScope->dump(outs(), 0, PDB_DumpLevel::Normal);
   outs().flush();
-}
-
-static void dumpCompilands(IDiaSession *Session) {
-  CComPtr<IDiaEnumSourceFiles> EnumSourceFileList;
-  if (FAILED(getDIATable(Session, &EnumSourceFileList)))
-    return;
-
-  LONG SourceFileCount = 0;
-  EnumSourceFileList->get_Count(&SourceFileCount);
-
-  CComPtr<IDiaSymbol> GlobalScope;
-  HRESULT hr = Session->get_globalScope(&GlobalScope);
-  DIASymbol GlobalScopeSymbol(GlobalScope);
-  if (S_OK != hr)
-    return;
-
-  CComPtr<IDiaEnumSymbols> EnumCompilands;
-  if (S_OK !=
-      GlobalScope->findChildren(SymTagCompiland, nullptr, nsNone,
-                                &EnumCompilands))
-    return;
-
-  LONG CompilandCount = 0;
-  EnumCompilands->get_Count(&CompilandCount);
-  outs() << "Dumping compilands [" << CompilandCount
-         << " compilands containing " << SourceFileCount << " source files]\n";
-
-  for (auto Compiland : make_com_enumerator(EnumCompilands)) {
-    DIASymbol CompilandSymbol(Compiland);
-    outs().indent(2);
-    outs() << CompilandSymbol.getName().value() << "\n";
 
-    CComPtr<IDiaEnumSourceFiles> EnumFiles;
-    if (S_OK != Session->findFile(Compiland, nullptr, nsNone, &EnumFiles))
-      continue;
-
-    for (auto SourceFile : make_com_enumerator(EnumFiles)) {
-      DWORD ChecksumType = 0;
-      DWORD ChecksumSize = 0;
-      std::vector<uint8_t> Checksum;
-      outs().indent(4);
-      SourceFile->get_checksumType(&ChecksumType);
-      if (S_OK == SourceFile->get_checksum(0, &ChecksumSize, nullptr)) {
-        Checksum.resize(ChecksumSize);
-        if (S_OK ==
-            SourceFile->get_checksum(ChecksumSize, &ChecksumSize,
-                                     &Checksum[0])) {
-          outs() << "[" << ((ChecksumType == HashMD5) ? "MD5  " : "SHA-1")
-                 << ": ";
-          for (auto byte : Checksum)
-            outs() << format_hex_no_prefix(byte, 2, true);
-          outs() << "] ";
-        }
+  if (opts::Compilands) {
+    auto Compilands = GlobalScope->findChildren(PDB_SymType::Compiland);
+    if (Compilands) {
+      while (auto Compiland = Compilands->getNext()) {
+        Compiland->dump(outs(), 0, PDB_DumpLevel::Normal);
       }
-      CComBSTR SourceFileName;
-      if (S_OK != SourceFile->get_fileName(&SourceFileName))
-        continue;
-
-      std::string SourceFileName8;
-      BSTRToUTF8(SourceFileName, SourceFileName8);
-      outs() << SourceFileName8 << "\n";
     }
   }
-
-  outs() << "\n";
   outs().flush();
 }
 
-static void dumpSymbols(IDiaSession *Session) {
-  CComPtr<IDiaEnumSymbols> EnumSymbols;
-  if (FAILED(getDIATable(Session, &EnumSymbols)))
-    return;
-
-  LONG SymbolCount = 0;
-  EnumSymbols->get_Count(&SymbolCount);
-
-  outs() << "Dumping symbols [" << SymbolCount << " symbols]\n";
-  int UnnamedSymbolCount = 0;
-  for (auto Symbol : make_com_enumerator(EnumSymbols)) {
-    DIASymbol SymbolSymbol(Symbol);
-    DIAResult<DIAString> SymbolName = SymbolSymbol.getName();
-    if (!SymbolName.hasValue() || SymbolName.value().empty()) {
-      ++UnnamedSymbolCount;
-      outs() << "  (Unnamed symbol)\n";
-    } else {
-      outs() << "  " << SymbolSymbol.getName().value() << "\n";
-    }
-    if (opts::SymbolDetails)
-      SymbolSymbol.fullDump(4);
-  }
-  outs() << "(Found " << UnnamedSymbolCount << " unnamed symbols)\n";
-  outs().flush();
-}
-
-static void dumpInput(StringRef Path) {
-  SmallVector<UTF16, 128> Path16String;
-  llvm::convertUTF8ToUTF16String(Path, Path16String);
-  wchar_t *Path16 = reinterpret_cast<wchar_t *>(Path16String.data());
-  CComPtr<IDiaDataSource> source;
-  HRESULT hr =
-      ::CoCreateInstance(CLSID_DiaSource, nullptr, CLSCTX_INPROC_SERVER,
-                         __uuidof(IDiaDataSource), (void **)&source);
-  if (FAILED(hr))
-    return;
-  if (FAILED(source->loadDataFromPdb(Path16)))
-    return;
-  CComPtr<IDiaSession> Session;
-  if (FAILED(source->openSession(&Session)))
-    return;
-
-  dumpBasicFileInfo(Path, Session);
-  if (opts::Streams || opts::StreamData) {
-    dumpDataStreams(Session);
-  }
-
-  if (opts::Tables) {
-    dumpDebugTables(Session);
-  }
-
-  if (opts::SourceFiles) {
-    dumpSourceFiles(Session);
-  }
-
-  if (opts::Compilands) {
-    dumpCompilands(Session);
-  }
-
-  if (opts::Symbols || opts::SymbolDetails) {
-    dumpSymbols(Session);
-  }
-}
-
 int main(int argc_, const char *argv_[]) {
   // Print a stack trace if we signal out.
   sys::PrintStackTraceOnErrorSignal();
diff --git a/tools/llvm-pdbdump/llvm-pdbdump.h b/tools/llvm-pdbdump/llvm-pdbdump.h
deleted file mode 100644 (file)
index e73289c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-//===- llvm-pdbdump.h - Common includes for llvm-pdbdump --------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Common defines and header includes for all llvm-pdbdump.  The definitions
-// here configure the necessary #defines and include system headers in the
-// proper order for using DIA.
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
-#define LLVM_TOOLS_LLVMPDBDUMP_LLVMPDBDUMP_H
-
-#define NTDDI_VERSION NTDDI_VISTA
-#define _WIN32_WINNT _WIN32_WINNT_VISTA
-#define WINVER _WIN32_WINNT_VISTA
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-
-// atlbase.h has to come before windows.h
-#include <atlbase.h>
-#include <windows.h>
-
-// DIA headers must come after windows headers.
-#include <cvconst.h>
-#include <dia2.h>
-
-#endif
\ No newline at end of file
index 5c9b377ba4b354a842d9ba548a45b88fe4f0e177..fd65d10dfed75fb1eae1fc2e5539149a2d1e6e12 100644 (file)
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include <type_traits>
 #include <unordered_map>
 
 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
 #include "gtest/gtest.h"
 using namespace llvm;
 
-namespace std {
-  template<>
-  struct hash<PDB_SymType> {
-  public:
-    std::size_t operator()(PDB_SymType Symbol) const {
-      return std::hash<int>()(static_cast<int>(Symbol));
-    }
-  };
-}
-
 namespace {
 
 #define MOCK_SYMBOL_ACCESSOR(Func)                                             \
@@ -82,17 +71,26 @@ class MockSession : public IPDBSession {
   getSourceFileById(uint32_t SymbolId) const override {
     return nullptr;
   }
-  std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override {
+  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override {
+    return nullptr;
+  }
+  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
+      const PDBSymbolCompiland &Compiland) const override {
     return nullptr;
   }
 };
 
 class MockRawSymbol : public IPDBRawSymbol {
 public:
-  MockRawSymbol(PDB_SymType SymType) : Type(SymType) {}
+  MockRawSymbol(const IPDBSession &PDBSession, PDB_SymType SymType)
+      : Session(PDBSession), Type(SymType) {}
 
-  void dump(llvm::raw_ostream &OS) const override {}
+  void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override {}
 
+  std::unique_ptr<IPDBEnumSymbols>
+  findChildren(PDB_SymType Type) const override {
+    return nullptr;
+  }
   std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type, StringRef Name,
                PDB_NameSearchFlags Flags) const override {
@@ -206,6 +204,7 @@ public:
   MOCK_SYMBOL_ACCESSOR(hasDebugInfo)
   MOCK_SYMBOL_ACCESSOR(hasEH)
   MOCK_SYMBOL_ACCESSOR(hasEHa)
+  MOCK_SYMBOL_ACCESSOR(hasFramePointer)
   MOCK_SYMBOL_ACCESSOR(hasInlAsm)
   MOCK_SYMBOL_ACCESSOR(hasInlineAttribute)
   MOCK_SYMBOL_ACCESSOR(hasInterruptReturn)
@@ -270,6 +269,7 @@ public:
   MOCK_SYMBOL_ACCESSOR(isVolatileType)
 
 private:
+  const IPDBSession &Session;
   PDB_SymType Type;
 };
 
@@ -334,7 +334,7 @@ private:
   std::unique_ptr<IPDBSession> Session;
 
   void InsertItemWithTag(PDB_SymType Tag) {
-    auto RawSymbol = std::unique_ptr<IPDBRawSymbol>(new MockRawSymbol(Tag));
+    auto RawSymbol = std::make_unique<MockRawSymbol>(*Session, Tag);
     auto Symbol = PDBSymbol::create(*Session, std::move(RawSymbol));
     SymbolMap.insert(std::make_pair(Tag, std::move(Symbol)));
   }