[llvm] r291627 - [CodeView/PDB] Rename a bunch of files.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 10 16:35:44 PST 2017
Author: zturner
Date: Tue Jan 10 18:35:43 2017
New Revision: 291627
URL: http://llvm.org/viewvc/llvm-project?rev=291627&view=rev
Log:
[CodeView/PDB] Rename a bunch of files.
We were starting to get some name clashes between llvm-pdbdump
and the common CodeView framework, so I took this opportunity
to rename a bunch of files to more accurately describe their
usage. This also helps in llvm-pdbdump to distinguish
between different files and whether they are used for pretty
dump mode or raw dump mode.
Added:
llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeDumper.h
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumperBase.h
llvm/trunk/lib/DebugInfo/CodeView/CVTypeDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.h
llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.cpp
llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.h
Removed:
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h
llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.cpp
llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.h
llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.h
llvm/trunk/tools/llvm-pdbdump/CompilandDumper.cpp
llvm/trunk/tools/llvm-pdbdump/CompilandDumper.h
llvm/trunk/tools/llvm-pdbdump/EnumDumper.cpp
llvm/trunk/tools/llvm-pdbdump/EnumDumper.h
llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.h
llvm/trunk/tools/llvm-pdbdump/FunctionDumper.cpp
llvm/trunk/tools/llvm-pdbdump/FunctionDumper.h
llvm/trunk/tools/llvm-pdbdump/TypeDumper.cpp
llvm/trunk/tools/llvm-pdbdump/TypeDumper.h
llvm/trunk/tools/llvm-pdbdump/TypedefDumper.cpp
llvm/trunk/tools/llvm-pdbdump/TypedefDumper.h
llvm/trunk/tools/llvm-pdbdump/VariableDumper.cpp
llvm/trunk/tools/llvm-pdbdump/VariableDumper.h
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt
llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt
llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.h
llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h
llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Added: llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeDumper.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,87 @@
+//===-- CVTypeDumper.h - CodeView type info dumper --------------*- 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_CODEVIEW_CVTYPEDUMPER_H
+#define LLVM_DEBUGINFO_CODEVIEW_CVTYPEDUMPER_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
+
+namespace llvm {
+class ScopedPrinter;
+
+namespace codeview {
+
+/// Dumper for CodeView type streams found in COFF object files and PDB files.
+class CVTypeDumper : public TypeVisitorCallbacks {
+public:
+ CVTypeDumper(ScopedPrinter *W, bool PrintRecordBytes)
+ : W(W), PrintRecordBytes(PrintRecordBytes) {}
+
+ void printTypeIndex(StringRef FieldName, TypeIndex TI);
+
+ /// Dumps one type record. Returns false if there was a type parsing error,
+ /// and true otherwise. This should be called in order, since the dumper
+ /// maintains state about previous records which are necessary for cross
+ /// type references.
+ Error dump(const CVRecord<TypeLeafKind> &Record);
+
+ /// Dumps the type records in Types. Returns false if there was a type stream
+ /// parse error, and true otherwise.
+ Error dump(const CVTypeArray &Types);
+
+ /// Dumps the type records in Data. Returns false if there was a type stream
+ /// parse error, and true otherwise. Use this method instead of the
+ /// CVTypeArray overload when type records are laid out contiguously in
+ /// memory.
+ Error dump(ArrayRef<uint8_t> Data);
+
+ void setPrinter(ScopedPrinter *P);
+ ScopedPrinter *getPrinter() { return W; }
+
+ /// Action to take on unknown types. By default, they are ignored.
+ Error visitUnknownType(CVType &Record) override;
+ Error visitUnknownMember(CVMemberRecord &Record) override;
+
+ /// Paired begin/end actions for all types. Receives all record data,
+ /// including the fixed-length record prefix.
+ Error visitTypeBegin(CVType &Record) override;
+ Error visitTypeEnd(CVType &Record) override;
+ Error visitMemberBegin(CVMemberRecord &Record) override;
+ Error visitMemberEnd(CVMemberRecord &Record) override;
+
+#define TYPE_RECORD(EnumName, EnumVal, Name) \
+ Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
+#define MEMBER_RECORD(EnumName, EnumVal, Name) \
+ Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
+#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
+#include "TypeRecords.def"
+
+private:
+ void printMemberAttributes(MemberAttributes Attrs);
+ void printMemberAttributes(MemberAccess Access, MethodKind Kind,
+ MethodOptions Options);
+
+ ScopedPrinter *W;
+
+ bool IsInFieldList = false;
+ bool PrintRecordBytes = false;
+
+ TypeDatabase TypeDB;
+};
+
+} // end namespace codeview
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H
Removed: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumper.h (removed)
@@ -1,87 +0,0 @@
-//===-- TypeDumper.h - CodeView type info dumper ----------------*- 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_CODEVIEW_TYPEDUMPER_H
-#define LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H
-
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/StringSet.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
-
-namespace llvm {
-class ScopedPrinter;
-
-namespace codeview {
-
-/// Dumper for CodeView type streams found in COFF object files and PDB files.
-class CVTypeDumper : public TypeVisitorCallbacks {
-public:
- CVTypeDumper(ScopedPrinter *W, bool PrintRecordBytes)
- : W(W), PrintRecordBytes(PrintRecordBytes) {}
-
- void printTypeIndex(StringRef FieldName, TypeIndex TI);
-
- /// Dumps one type record. Returns false if there was a type parsing error,
- /// and true otherwise. This should be called in order, since the dumper
- /// maintains state about previous records which are necessary for cross
- /// type references.
- Error dump(const CVRecord<TypeLeafKind> &Record);
-
- /// Dumps the type records in Types. Returns false if there was a type stream
- /// parse error, and true otherwise.
- Error dump(const CVTypeArray &Types);
-
- /// Dumps the type records in Data. Returns false if there was a type stream
- /// parse error, and true otherwise. Use this method instead of the
- /// CVTypeArray overload when type records are laid out contiguously in
- /// memory.
- Error dump(ArrayRef<uint8_t> Data);
-
- void setPrinter(ScopedPrinter *P);
- ScopedPrinter *getPrinter() { return W; }
-
- /// Action to take on unknown types. By default, they are ignored.
- Error visitUnknownType(CVType &Record) override;
- Error visitUnknownMember(CVMemberRecord &Record) override;
-
- /// Paired begin/end actions for all types. Receives all record data,
- /// including the fixed-length record prefix.
- Error visitTypeBegin(CVType &Record) override;
- Error visitTypeEnd(CVType &Record) override;
- Error visitMemberBegin(CVMemberRecord &Record) override;
- Error visitMemberEnd(CVMemberRecord &Record) override;
-
-#define TYPE_RECORD(EnumName, EnumVal, Name) \
- Error visitKnownRecord(CVType &CVR, Name##Record &Record) override;
-#define MEMBER_RECORD(EnumName, EnumVal, Name) \
- Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override;
-#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
-#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
-#include "TypeRecords.def"
-
-private:
- void printMemberAttributes(MemberAttributes Attrs);
- void printMemberAttributes(MemberAccess Access, MethodKind Kind,
- MethodOptions Options);
-
- ScopedPrinter *W;
-
- bool IsInFieldList = false;
- bool PrintRecordBytes = false;
-
- TypeDatabase TypeDB;
-};
-
-} // end namespace codeview
-} // end namespace llvm
-
-#endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDUMPER_H
Added: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumperBase.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeDumperBase.h?rev=291627&view=auto
==============================================================================
(empty)
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Tue Jan 10 18:35:43 2017
@@ -13,12 +13,12 @@
#include "CodeViewDebug.h"
#include "llvm/ADT/TinyPtrVector.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
Modified: llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/CMakeLists.txt Tue Jan 10 18:35:43 2017
@@ -2,6 +2,7 @@ add_llvm_library(LLVMDebugInfoCodeView
CodeViewError.cpp
CodeViewRecordIO.cpp
CVSymbolVisitor.cpp
+ CVTypeDumper.cpp
CVTypeVisitor.cpp
EnumTables.cpp
Line.cpp
@@ -12,7 +13,6 @@ add_llvm_library(LLVMDebugInfoCodeView
SymbolDumper.cpp
TypeDatabase.cpp
TypeDatabaseVisitor.cpp
- TypeDumper.cpp
TypeRecord.cpp
TypeRecordMapping.cpp
TypeSerializer.cpp
Added: llvm/trunk/lib/DebugInfo/CodeView/CVTypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/CVTypeDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/CVTypeDumper.cpp (added)
+++ llvm/trunk/lib/DebugInfo/CodeView/CVTypeDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,579 @@
+//===-- CVTypeDumper.cpp - CodeView type info dumper ------------*- 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/CodeView/CVTypeDumper.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
+#include "llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/DebugInfo/CodeView/TypeRecord.h"
+#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
+#include "llvm/DebugInfo/MSF/ByteStream.h"
+#include "llvm/Support/ScopedPrinter.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+
+static const EnumEntry<TypeLeafKind> LeafTypeNames[] = {
+#define CV_TYPE(enum, val) {#enum, enum},
+#include "llvm/DebugInfo/CodeView/TypeRecords.def"
+};
+
+#define ENUM_ENTRY(enum_class, enum) \
+ { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
+
+static const EnumEntry<uint16_t> ClassOptionNames[] = {
+ ENUM_ENTRY(ClassOptions, Packed),
+ ENUM_ENTRY(ClassOptions, HasConstructorOrDestructor),
+ ENUM_ENTRY(ClassOptions, HasOverloadedOperator),
+ ENUM_ENTRY(ClassOptions, Nested),
+ ENUM_ENTRY(ClassOptions, ContainsNestedClass),
+ ENUM_ENTRY(ClassOptions, HasOverloadedAssignmentOperator),
+ ENUM_ENTRY(ClassOptions, HasConversionOperator),
+ ENUM_ENTRY(ClassOptions, ForwardReference),
+ ENUM_ENTRY(ClassOptions, Scoped),
+ ENUM_ENTRY(ClassOptions, HasUniqueName),
+ ENUM_ENTRY(ClassOptions, Sealed),
+ ENUM_ENTRY(ClassOptions, Intrinsic),
+};
+
+static const EnumEntry<uint8_t> MemberAccessNames[] = {
+ ENUM_ENTRY(MemberAccess, None), ENUM_ENTRY(MemberAccess, Private),
+ ENUM_ENTRY(MemberAccess, Protected), ENUM_ENTRY(MemberAccess, Public),
+};
+
+static const EnumEntry<uint16_t> MethodOptionNames[] = {
+ ENUM_ENTRY(MethodOptions, Pseudo),
+ ENUM_ENTRY(MethodOptions, NoInherit),
+ ENUM_ENTRY(MethodOptions, NoConstruct),
+ ENUM_ENTRY(MethodOptions, CompilerGenerated),
+ ENUM_ENTRY(MethodOptions, Sealed),
+};
+
+static const EnumEntry<uint16_t> MemberKindNames[] = {
+ ENUM_ENTRY(MethodKind, Vanilla),
+ ENUM_ENTRY(MethodKind, Virtual),
+ ENUM_ENTRY(MethodKind, Static),
+ ENUM_ENTRY(MethodKind, Friend),
+ ENUM_ENTRY(MethodKind, IntroducingVirtual),
+ ENUM_ENTRY(MethodKind, PureVirtual),
+ ENUM_ENTRY(MethodKind, PureIntroducingVirtual),
+};
+
+static const EnumEntry<uint8_t> PtrKindNames[] = {
+ ENUM_ENTRY(PointerKind, Near16),
+ ENUM_ENTRY(PointerKind, Far16),
+ ENUM_ENTRY(PointerKind, Huge16),
+ ENUM_ENTRY(PointerKind, BasedOnSegment),
+ ENUM_ENTRY(PointerKind, BasedOnValue),
+ ENUM_ENTRY(PointerKind, BasedOnSegmentValue),
+ ENUM_ENTRY(PointerKind, BasedOnAddress),
+ ENUM_ENTRY(PointerKind, BasedOnSegmentAddress),
+ ENUM_ENTRY(PointerKind, BasedOnType),
+ ENUM_ENTRY(PointerKind, BasedOnSelf),
+ ENUM_ENTRY(PointerKind, Near32),
+ ENUM_ENTRY(PointerKind, Far32),
+ ENUM_ENTRY(PointerKind, Near64),
+};
+
+static const EnumEntry<uint8_t> PtrModeNames[] = {
+ ENUM_ENTRY(PointerMode, Pointer),
+ ENUM_ENTRY(PointerMode, LValueReference),
+ ENUM_ENTRY(PointerMode, PointerToDataMember),
+ ENUM_ENTRY(PointerMode, PointerToMemberFunction),
+ ENUM_ENTRY(PointerMode, RValueReference),
+};
+
+static const EnumEntry<uint16_t> PtrMemberRepNames[] = {
+ ENUM_ENTRY(PointerToMemberRepresentation, Unknown),
+ ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceData),
+ ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceData),
+ ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceData),
+ ENUM_ENTRY(PointerToMemberRepresentation, GeneralData),
+ ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceFunction),
+ ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceFunction),
+ ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceFunction),
+ ENUM_ENTRY(PointerToMemberRepresentation, GeneralFunction),
+};
+
+static const EnumEntry<uint16_t> TypeModifierNames[] = {
+ ENUM_ENTRY(ModifierOptions, Const), ENUM_ENTRY(ModifierOptions, Volatile),
+ ENUM_ENTRY(ModifierOptions, Unaligned),
+};
+
+static const EnumEntry<uint8_t> CallingConventions[] = {
+ ENUM_ENTRY(CallingConvention, NearC),
+ ENUM_ENTRY(CallingConvention, FarC),
+ ENUM_ENTRY(CallingConvention, NearPascal),
+ ENUM_ENTRY(CallingConvention, FarPascal),
+ ENUM_ENTRY(CallingConvention, NearFast),
+ ENUM_ENTRY(CallingConvention, FarFast),
+ ENUM_ENTRY(CallingConvention, NearStdCall),
+ ENUM_ENTRY(CallingConvention, FarStdCall),
+ ENUM_ENTRY(CallingConvention, NearSysCall),
+ ENUM_ENTRY(CallingConvention, FarSysCall),
+ ENUM_ENTRY(CallingConvention, ThisCall),
+ ENUM_ENTRY(CallingConvention, MipsCall),
+ ENUM_ENTRY(CallingConvention, Generic),
+ ENUM_ENTRY(CallingConvention, AlphaCall),
+ ENUM_ENTRY(CallingConvention, PpcCall),
+ ENUM_ENTRY(CallingConvention, SHCall),
+ ENUM_ENTRY(CallingConvention, ArmCall),
+ ENUM_ENTRY(CallingConvention, AM33Call),
+ ENUM_ENTRY(CallingConvention, TriCall),
+ ENUM_ENTRY(CallingConvention, SH5Call),
+ ENUM_ENTRY(CallingConvention, M32RCall),
+ ENUM_ENTRY(CallingConvention, ClrCall),
+ ENUM_ENTRY(CallingConvention, Inline),
+ ENUM_ENTRY(CallingConvention, NearVector),
+};
+
+static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
+ ENUM_ENTRY(FunctionOptions, CxxReturnUdt),
+ ENUM_ENTRY(FunctionOptions, Constructor),
+ ENUM_ENTRY(FunctionOptions, ConstructorWithVirtualBases),
+};
+
+#undef ENUM_ENTRY
+
+static StringRef getLeafTypeName(TypeLeafKind LT) {
+ switch (LT) {
+#define TYPE_RECORD(ename, value, name) \
+ case ename: \
+ return #name;
+#include "llvm/DebugInfo/CodeView/TypeRecords.def"
+ default:
+ break;
+ }
+ return "UnknownLeaf";
+}
+
+Error CVTypeDumper::visitTypeBegin(CVType &Record) {
+ W->startLine() << getLeafTypeName(Record.Type);
+ W->getOStream() << " (" << HexNumber(TypeDB.getNextTypeIndex().getIndex())
+ << ")";
+ W->getOStream() << " {\n";
+ W->indent();
+ W->printEnum("TypeLeafKind", unsigned(Record.Type),
+ makeArrayRef(LeafTypeNames));
+ return Error::success();
+}
+
+Error CVTypeDumper::visitTypeEnd(CVType &Record) {
+ if (PrintRecordBytes)
+ W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.content()));
+
+ W->unindent();
+ W->startLine() << "}\n";
+ return Error::success();
+}
+
+Error CVTypeDumper::visitMemberBegin(CVMemberRecord &Record) {
+ W->startLine() << getLeafTypeName(Record.Kind);
+ W->getOStream() << " {\n";
+ W->indent();
+ W->printEnum("TypeLeafKind", unsigned(Record.Kind),
+ makeArrayRef(LeafTypeNames));
+ return Error::success();
+}
+
+Error CVTypeDumper::visitMemberEnd(CVMemberRecord &Record) {
+ if (PrintRecordBytes)
+ W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.Data));
+
+ W->unindent();
+ W->startLine() << "}\n";
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, FieldListRecord &FieldList) {
+ CVTypeVisitor Visitor(*this);
+ if (auto EC = Visitor.visitFieldListMemberStream(FieldList.Data))
+ return EC;
+
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, StringIdRecord &String) {
+ printTypeIndex("Id", String.getId());
+ W->printString("StringData", String.getString());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, ArgListRecord &Args) {
+ auto Indices = Args.getIndices();
+ uint32_t Size = Indices.size();
+ W->printNumber("NumArgs", Size);
+ ListScope Arguments(*W, "Arguments");
+ for (uint32_t I = 0; I < Size; ++I) {
+ printTypeIndex("ArgType", Indices[I]);
+ }
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
+ uint16_t Props = static_cast<uint16_t>(Class.getOptions());
+ W->printNumber("MemberCount", Class.getMemberCount());
+ W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
+ printTypeIndex("FieldList", Class.getFieldList());
+ printTypeIndex("DerivedFrom", Class.getDerivationList());
+ printTypeIndex("VShape", Class.getVTableShape());
+ W->printNumber("SizeOf", Class.getSize());
+ W->printString("Name", Class.getName());
+ if (Props & uint16_t(ClassOptions::HasUniqueName))
+ W->printString("LinkageName", Class.getUniqueName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, UnionRecord &Union) {
+ uint16_t Props = static_cast<uint16_t>(Union.getOptions());
+ W->printNumber("MemberCount", Union.getMemberCount());
+ W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
+ printTypeIndex("FieldList", Union.getFieldList());
+ W->printNumber("SizeOf", Union.getSize());
+ W->printString("Name", Union.getName());
+ if (Props & uint16_t(ClassOptions::HasUniqueName))
+ W->printString("LinkageName", Union.getUniqueName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, EnumRecord &Enum) {
+ uint16_t Props = static_cast<uint16_t>(Enum.getOptions());
+ W->printNumber("NumEnumerators", Enum.getMemberCount());
+ W->printFlags("Properties", uint16_t(Enum.getOptions()),
+ makeArrayRef(ClassOptionNames));
+ printTypeIndex("UnderlyingType", Enum.getUnderlyingType());
+ printTypeIndex("FieldListType", Enum.getFieldList());
+ W->printString("Name", Enum.getName());
+ if (Props & uint16_t(ClassOptions::HasUniqueName))
+ W->printString("LinkageName", Enum.getUniqueName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, ArrayRecord &AT) {
+ printTypeIndex("ElementType", AT.getElementType());
+ printTypeIndex("IndexType", AT.getIndexType());
+ W->printNumber("SizeOf", AT.getSize());
+ W->printString("Name", AT.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, VFTableRecord &VFT) {
+ printTypeIndex("CompleteClass", VFT.getCompleteClass());
+ printTypeIndex("OverriddenVFTable", VFT.getOverriddenVTable());
+ W->printHex("VFPtrOffset", VFT.getVFPtrOffset());
+ W->printString("VFTableName", VFT.getName());
+ for (auto N : VFT.getMethodNames())
+ W->printString("MethodName", N);
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, MemberFuncIdRecord &Id) {
+ printTypeIndex("ClassType", Id.getClassType());
+ printTypeIndex("FunctionType", Id.getFunctionType());
+ W->printString("Name", Id.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, ProcedureRecord &Proc) {
+ printTypeIndex("ReturnType", Proc.getReturnType());
+ W->printEnum("CallingConvention", uint8_t(Proc.getCallConv()),
+ makeArrayRef(CallingConventions));
+ W->printFlags("FunctionOptions", uint8_t(Proc.getOptions()),
+ makeArrayRef(FunctionOptionEnum));
+ W->printNumber("NumParameters", Proc.getParameterCount());
+ printTypeIndex("ArgListType", Proc.getArgumentList());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, MemberFunctionRecord &MF) {
+ printTypeIndex("ReturnType", MF.getReturnType());
+ printTypeIndex("ClassType", MF.getClassType());
+ printTypeIndex("ThisType", MF.getThisType());
+ W->printEnum("CallingConvention", uint8_t(MF.getCallConv()),
+ makeArrayRef(CallingConventions));
+ W->printFlags("FunctionOptions", uint8_t(MF.getOptions()),
+ makeArrayRef(FunctionOptionEnum));
+ W->printNumber("NumParameters", MF.getParameterCount());
+ printTypeIndex("ArgListType", MF.getArgumentList());
+ W->printNumber("ThisAdjustment", MF.getThisPointerAdjustment());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR,
+ MethodOverloadListRecord &MethodList) {
+ for (auto &M : MethodList.getMethods()) {
+ ListScope S(*W, "Method");
+ printMemberAttributes(M.getAccess(), M.getMethodKind(), M.getOptions());
+ printTypeIndex("Type", M.getType());
+ if (M.isIntroducingVirtual())
+ W->printHex("VFTableOffset", M.getVFTableOffset());
+ }
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, FuncIdRecord &Func) {
+ printTypeIndex("ParentScope", Func.getParentScope());
+ printTypeIndex("FunctionType", Func.getFunctionType());
+ W->printString("Name", Func.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, TypeServer2Record &TS) {
+ W->printBinary("Signature", TS.getGuid());
+ W->printNumber("Age", TS.getAge());
+ W->printString("Name", TS.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
+ printTypeIndex("PointeeType", Ptr.getReferentType());
+ W->printHex("PointerAttributes", uint32_t(Ptr.getOptions()));
+ W->printEnum("PtrType", unsigned(Ptr.getPointerKind()),
+ makeArrayRef(PtrKindNames));
+ W->printEnum("PtrMode", unsigned(Ptr.getMode()), makeArrayRef(PtrModeNames));
+
+ W->printNumber("IsFlat", Ptr.isFlat());
+ W->printNumber("IsConst", Ptr.isConst());
+ W->printNumber("IsVolatile", Ptr.isVolatile());
+ W->printNumber("IsUnaligned", Ptr.isUnaligned());
+ W->printNumber("SizeOf", Ptr.getSize());
+
+ if (Ptr.isPointerToMember()) {
+ const MemberPointerInfo &MI = Ptr.getMemberInfo();
+
+ printTypeIndex("ClassType", MI.getContainingType());
+ W->printEnum("Representation", uint16_t(MI.getRepresentation()),
+ makeArrayRef(PtrMemberRepNames));
+ }
+
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, ModifierRecord &Mod) {
+ uint16_t Mods = static_cast<uint16_t>(Mod.getModifiers());
+ printTypeIndex("ModifiedType", Mod.getModifiedType());
+ W->printFlags("Modifiers", Mods, makeArrayRef(TypeModifierNames));
+
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, BitFieldRecord &BitField) {
+ printTypeIndex("Type", BitField.getType());
+ W->printNumber("BitSize", BitField.getBitSize());
+ W->printNumber("BitOffset", BitField.getBitOffset());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, VFTableShapeRecord &Shape) {
+ W->printNumber("VFEntryCount", Shape.getEntryCount());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, UdtSourceLineRecord &Line) {
+ printTypeIndex("UDT", Line.getUDT());
+ printTypeIndex("SourceFile", Line.getSourceFile());
+ W->printNumber("LineNumber", Line.getLineNumber());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR,
+ UdtModSourceLineRecord &Line) {
+ printTypeIndex("UDT", Line.getUDT());
+ printTypeIndex("SourceFile", Line.getSourceFile());
+ W->printNumber("LineNumber", Line.getLineNumber());
+ W->printNumber("Module", Line.getModule());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownRecord(CVType &CVR, BuildInfoRecord &Args) {
+ W->printNumber("NumArgs", static_cast<uint32_t>(Args.getArgs().size()));
+
+ ListScope Arguments(*W, "Arguments");
+ for (auto Arg : Args.getArgs()) {
+ printTypeIndex("ArgType", Arg);
+ }
+ return Error::success();
+}
+
+void CVTypeDumper::printMemberAttributes(MemberAttributes Attrs) {
+ return printMemberAttributes(Attrs.getAccess(), Attrs.getMethodKind(),
+ Attrs.getFlags());
+}
+
+void CVTypeDumper::printMemberAttributes(MemberAccess Access, MethodKind Kind,
+ MethodOptions Options) {
+ W->printEnum("AccessSpecifier", uint8_t(Access),
+ makeArrayRef(MemberAccessNames));
+ // Data members will be vanilla. Don't try to print a method kind for them.
+ if (Kind != MethodKind::Vanilla)
+ W->printEnum("MethodKind", unsigned(Kind), makeArrayRef(MemberKindNames));
+ if (Options != MethodOptions::None) {
+ W->printFlags("MethodOptions", unsigned(Options),
+ makeArrayRef(MethodOptionNames));
+ }
+}
+
+Error CVTypeDumper::visitUnknownMember(CVMemberRecord &Record) {
+ W->printHex("UnknownMember", unsigned(Record.Kind));
+ return Error::success();
+}
+
+Error CVTypeDumper::visitUnknownType(CVType &Record) {
+ W->printEnum("Kind", uint16_t(Record.kind()), makeArrayRef(LeafTypeNames));
+ W->printNumber("Length", uint32_t(Record.content().size()));
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ NestedTypeRecord &Nested) {
+ printTypeIndex("Type", Nested.getNestedType());
+ W->printString("Name", Nested.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ OneMethodRecord &Method) {
+ MethodKind K = Method.getMethodKind();
+ printMemberAttributes(Method.getAccess(), K, Method.getOptions());
+ printTypeIndex("Type", Method.getType());
+ // If virtual, then read the vftable offset.
+ if (Method.isIntroducingVirtual())
+ W->printHex("VFTableOffset", Method.getVFTableOffset());
+ W->printString("Name", Method.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ OverloadedMethodRecord &Method) {
+ W->printHex("MethodCount", Method.getNumOverloads());
+ printTypeIndex("MethodListIndex", Method.getMethodList());
+ W->printString("Name", Method.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ DataMemberRecord &Field) {
+ printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
+ MethodOptions::None);
+ printTypeIndex("Type", Field.getType());
+ W->printHex("FieldOffset", Field.getFieldOffset());
+ W->printString("Name", Field.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ StaticDataMemberRecord &Field) {
+ printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
+ MethodOptions::None);
+ printTypeIndex("Type", Field.getType());
+ W->printString("Name", Field.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ VFPtrRecord &VFTable) {
+ printTypeIndex("Type", VFTable.getType());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ EnumeratorRecord &Enum) {
+ printMemberAttributes(Enum.getAccess(), MethodKind::Vanilla,
+ MethodOptions::None);
+ W->printNumber("EnumValue", Enum.getValue());
+ W->printString("Name", Enum.getName());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ BaseClassRecord &Base) {
+ printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
+ MethodOptions::None);
+ printTypeIndex("BaseType", Base.getBaseType());
+ W->printHex("BaseOffset", Base.getBaseOffset());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ VirtualBaseClassRecord &Base) {
+ printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
+ MethodOptions::None);
+ printTypeIndex("BaseType", Base.getBaseType());
+ printTypeIndex("VBPtrType", Base.getVBPtrType());
+ W->printHex("VBPtrOffset", Base.getVBPtrOffset());
+ W->printHex("VBTableIndex", Base.getVTableIndex());
+ return Error::success();
+}
+
+Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
+ ListContinuationRecord &Cont) {
+ printTypeIndex("ContinuationIndex", Cont.getContinuationIndex());
+ return Error::success();
+}
+
+void CVTypeDumper::printTypeIndex(StringRef FieldName, TypeIndex TI) {
+ StringRef TypeName;
+ if (!TI.isNoneType())
+ TypeName = TypeDB.getTypeName(TI);
+ if (!TypeName.empty())
+ W->printHex(FieldName, TypeName, TI.getIndex());
+ else
+ W->printHex(FieldName, TI.getIndex());
+}
+
+Error CVTypeDumper::dump(const CVType &Record) {
+ assert(W && "printer should not be null");
+ TypeDatabaseVisitor DBV(TypeDB);
+ TypeDeserializer Deserializer;
+ TypeVisitorCallbackPipeline Pipeline;
+ Pipeline.addCallbackToPipeline(Deserializer);
+ Pipeline.addCallbackToPipeline(DBV);
+ Pipeline.addCallbackToPipeline(*this);
+
+ CVTypeVisitor Visitor(Pipeline);
+
+ CVType RecordCopy = Record;
+ if (auto EC = Visitor.visitTypeRecord(RecordCopy))
+ return EC;
+ return Error::success();
+}
+
+Error CVTypeDumper::dump(const CVTypeArray &Types) {
+ assert(W && "printer should not be null");
+ TypeDatabaseVisitor DBV(TypeDB);
+ TypeDeserializer Deserializer;
+ TypeVisitorCallbackPipeline Pipeline;
+ Pipeline.addCallbackToPipeline(Deserializer);
+ Pipeline.addCallbackToPipeline(DBV);
+ Pipeline.addCallbackToPipeline(*this);
+
+ CVTypeVisitor Visitor(Pipeline);
+
+ if (auto EC = Visitor.visitTypeStream(Types))
+ return EC;
+ return Error::success();
+}
+
+Error CVTypeDumper::dump(ArrayRef<uint8_t> Data) {
+ msf::ByteStream Stream(Data);
+ CVTypeArray Types;
+ msf::StreamReader Reader(Stream);
+ if (auto EC = Reader.readArray(Types, Reader.getLength()))
+ return EC;
+
+ return dump(Types);
+}
+
+void CVTypeDumper::setPrinter(ScopedPrinter *P) {
+ static ScopedPrinter NullP(llvm::nulls());
+ W = P ? P : &NullP;
+}
Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp Tue Jan 10 18:35:43 2017
@@ -11,13 +11,13 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ScopedPrinter.h"
Removed: llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp (removed)
@@ -1,582 +0,0 @@
-//===-- TypeDumper.cpp - CodeView type info dumper --------------*- 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/CodeView/TypeDumper.h"
-#include "llvm/ADT/SmallString.h"
-#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabaseVisitor.h"
-#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
-#include "llvm/DebugInfo/CodeView/TypeIndex.h"
-#include "llvm/DebugInfo/CodeView/TypeRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h"
-#include "llvm/DebugInfo/MSF/ByteStream.h"
-#include "llvm/Support/ScopedPrinter.h"
-
-using namespace llvm;
-using namespace llvm::codeview;
-
-static const EnumEntry<TypeLeafKind> LeafTypeNames[] = {
-#define CV_TYPE(enum, val) {#enum, enum},
-#include "llvm/DebugInfo/CodeView/TypeRecords.def"
-};
-
-#define ENUM_ENTRY(enum_class, enum) \
- { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
-
-static const EnumEntry<uint16_t> ClassOptionNames[] = {
- ENUM_ENTRY(ClassOptions, Packed),
- ENUM_ENTRY(ClassOptions, HasConstructorOrDestructor),
- ENUM_ENTRY(ClassOptions, HasOverloadedOperator),
- ENUM_ENTRY(ClassOptions, Nested),
- ENUM_ENTRY(ClassOptions, ContainsNestedClass),
- ENUM_ENTRY(ClassOptions, HasOverloadedAssignmentOperator),
- ENUM_ENTRY(ClassOptions, HasConversionOperator),
- ENUM_ENTRY(ClassOptions, ForwardReference),
- ENUM_ENTRY(ClassOptions, Scoped),
- ENUM_ENTRY(ClassOptions, HasUniqueName),
- ENUM_ENTRY(ClassOptions, Sealed),
- ENUM_ENTRY(ClassOptions, Intrinsic),
-};
-
-static const EnumEntry<uint8_t> MemberAccessNames[] = {
- ENUM_ENTRY(MemberAccess, None),
- ENUM_ENTRY(MemberAccess, Private),
- ENUM_ENTRY(MemberAccess, Protected),
- ENUM_ENTRY(MemberAccess, Public),
-};
-
-static const EnumEntry<uint16_t> MethodOptionNames[] = {
- ENUM_ENTRY(MethodOptions, Pseudo),
- ENUM_ENTRY(MethodOptions, NoInherit),
- ENUM_ENTRY(MethodOptions, NoConstruct),
- ENUM_ENTRY(MethodOptions, CompilerGenerated),
- ENUM_ENTRY(MethodOptions, Sealed),
-};
-
-static const EnumEntry<uint16_t> MemberKindNames[] = {
- ENUM_ENTRY(MethodKind, Vanilla),
- ENUM_ENTRY(MethodKind, Virtual),
- ENUM_ENTRY(MethodKind, Static),
- ENUM_ENTRY(MethodKind, Friend),
- ENUM_ENTRY(MethodKind, IntroducingVirtual),
- ENUM_ENTRY(MethodKind, PureVirtual),
- ENUM_ENTRY(MethodKind, PureIntroducingVirtual),
-};
-
-static const EnumEntry<uint8_t> PtrKindNames[] = {
- ENUM_ENTRY(PointerKind, Near16),
- ENUM_ENTRY(PointerKind, Far16),
- ENUM_ENTRY(PointerKind, Huge16),
- ENUM_ENTRY(PointerKind, BasedOnSegment),
- ENUM_ENTRY(PointerKind, BasedOnValue),
- ENUM_ENTRY(PointerKind, BasedOnSegmentValue),
- ENUM_ENTRY(PointerKind, BasedOnAddress),
- ENUM_ENTRY(PointerKind, BasedOnSegmentAddress),
- ENUM_ENTRY(PointerKind, BasedOnType),
- ENUM_ENTRY(PointerKind, BasedOnSelf),
- ENUM_ENTRY(PointerKind, Near32),
- ENUM_ENTRY(PointerKind, Far32),
- ENUM_ENTRY(PointerKind, Near64),
-};
-
-static const EnumEntry<uint8_t> PtrModeNames[] = {
- ENUM_ENTRY(PointerMode, Pointer),
- ENUM_ENTRY(PointerMode, LValueReference),
- ENUM_ENTRY(PointerMode, PointerToDataMember),
- ENUM_ENTRY(PointerMode, PointerToMemberFunction),
- ENUM_ENTRY(PointerMode, RValueReference),
-};
-
-static const EnumEntry<uint16_t> PtrMemberRepNames[] = {
- ENUM_ENTRY(PointerToMemberRepresentation, Unknown),
- ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceData),
- ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceData),
- ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceData),
- ENUM_ENTRY(PointerToMemberRepresentation, GeneralData),
- ENUM_ENTRY(PointerToMemberRepresentation, SingleInheritanceFunction),
- ENUM_ENTRY(PointerToMemberRepresentation, MultipleInheritanceFunction),
- ENUM_ENTRY(PointerToMemberRepresentation, VirtualInheritanceFunction),
- ENUM_ENTRY(PointerToMemberRepresentation, GeneralFunction),
-};
-
-static const EnumEntry<uint16_t> TypeModifierNames[] = {
- ENUM_ENTRY(ModifierOptions, Const),
- ENUM_ENTRY(ModifierOptions, Volatile),
- ENUM_ENTRY(ModifierOptions, Unaligned),
-};
-
-static const EnumEntry<uint8_t> CallingConventions[] = {
- ENUM_ENTRY(CallingConvention, NearC),
- ENUM_ENTRY(CallingConvention, FarC),
- ENUM_ENTRY(CallingConvention, NearPascal),
- ENUM_ENTRY(CallingConvention, FarPascal),
- ENUM_ENTRY(CallingConvention, NearFast),
- ENUM_ENTRY(CallingConvention, FarFast),
- ENUM_ENTRY(CallingConvention, NearStdCall),
- ENUM_ENTRY(CallingConvention, FarStdCall),
- ENUM_ENTRY(CallingConvention, NearSysCall),
- ENUM_ENTRY(CallingConvention, FarSysCall),
- ENUM_ENTRY(CallingConvention, ThisCall),
- ENUM_ENTRY(CallingConvention, MipsCall),
- ENUM_ENTRY(CallingConvention, Generic),
- ENUM_ENTRY(CallingConvention, AlphaCall),
- ENUM_ENTRY(CallingConvention, PpcCall),
- ENUM_ENTRY(CallingConvention, SHCall),
- ENUM_ENTRY(CallingConvention, ArmCall),
- ENUM_ENTRY(CallingConvention, AM33Call),
- ENUM_ENTRY(CallingConvention, TriCall),
- ENUM_ENTRY(CallingConvention, SH5Call),
- ENUM_ENTRY(CallingConvention, M32RCall),
- ENUM_ENTRY(CallingConvention, ClrCall),
- ENUM_ENTRY(CallingConvention, Inline),
- ENUM_ENTRY(CallingConvention, NearVector),
-};
-
-static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
- ENUM_ENTRY(FunctionOptions, CxxReturnUdt),
- ENUM_ENTRY(FunctionOptions, Constructor),
- ENUM_ENTRY(FunctionOptions, ConstructorWithVirtualBases),
-};
-
-#undef ENUM_ENTRY
-
-static StringRef getLeafTypeName(TypeLeafKind LT) {
- switch (LT) {
-#define TYPE_RECORD(ename, value, name) \
- case ename: \
- return #name;
-#include "llvm/DebugInfo/CodeView/TypeRecords.def"
- default:
- break;
- }
- return "UnknownLeaf";
-}
-
-Error CVTypeDumper::visitTypeBegin(CVType &Record) {
- W->startLine() << getLeafTypeName(Record.Type);
- W->getOStream() << " (" << HexNumber(TypeDB.getNextTypeIndex().getIndex())
- << ")";
- W->getOStream() << " {\n";
- W->indent();
- W->printEnum("TypeLeafKind", unsigned(Record.Type),
- makeArrayRef(LeafTypeNames));
- return Error::success();
-}
-
-Error CVTypeDumper::visitTypeEnd(CVType &Record) {
- if (PrintRecordBytes)
- W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.content()));
-
- W->unindent();
- W->startLine() << "}\n";
- return Error::success();
-}
-
-Error CVTypeDumper::visitMemberBegin(CVMemberRecord &Record) {
- W->startLine() << getLeafTypeName(Record.Kind);
- W->getOStream() << " {\n";
- W->indent();
- W->printEnum("TypeLeafKind", unsigned(Record.Kind),
- makeArrayRef(LeafTypeNames));
- return Error::success();
-}
-
-Error CVTypeDumper::visitMemberEnd(CVMemberRecord &Record) {
- if (PrintRecordBytes)
- W->printBinaryBlock("LeafData", getBytesAsCharacters(Record.Data));
-
- W->unindent();
- W->startLine() << "}\n";
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, FieldListRecord &FieldList) {
- CVTypeVisitor Visitor(*this);
- if (auto EC = Visitor.visitFieldListMemberStream(FieldList.Data))
- return EC;
-
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, StringIdRecord &String) {
- printTypeIndex("Id", String.getId());
- W->printString("StringData", String.getString());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, ArgListRecord &Args) {
- auto Indices = Args.getIndices();
- uint32_t Size = Indices.size();
- W->printNumber("NumArgs", Size);
- ListScope Arguments(*W, "Arguments");
- for (uint32_t I = 0; I < Size; ++I) {
- printTypeIndex("ArgType", Indices[I]);
- }
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
- uint16_t Props = static_cast<uint16_t>(Class.getOptions());
- W->printNumber("MemberCount", Class.getMemberCount());
- W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
- printTypeIndex("FieldList", Class.getFieldList());
- printTypeIndex("DerivedFrom", Class.getDerivationList());
- printTypeIndex("VShape", Class.getVTableShape());
- W->printNumber("SizeOf", Class.getSize());
- W->printString("Name", Class.getName());
- if (Props & uint16_t(ClassOptions::HasUniqueName))
- W->printString("LinkageName", Class.getUniqueName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, UnionRecord &Union) {
- uint16_t Props = static_cast<uint16_t>(Union.getOptions());
- W->printNumber("MemberCount", Union.getMemberCount());
- W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
- printTypeIndex("FieldList", Union.getFieldList());
- W->printNumber("SizeOf", Union.getSize());
- W->printString("Name", Union.getName());
- if (Props & uint16_t(ClassOptions::HasUniqueName))
- W->printString("LinkageName", Union.getUniqueName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, EnumRecord &Enum) {
- uint16_t Props = static_cast<uint16_t>(Enum.getOptions());
- W->printNumber("NumEnumerators", Enum.getMemberCount());
- W->printFlags("Properties", uint16_t(Enum.getOptions()),
- makeArrayRef(ClassOptionNames));
- printTypeIndex("UnderlyingType", Enum.getUnderlyingType());
- printTypeIndex("FieldListType", Enum.getFieldList());
- W->printString("Name", Enum.getName());
- if (Props & uint16_t(ClassOptions::HasUniqueName))
- W->printString("LinkageName", Enum.getUniqueName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, ArrayRecord &AT) {
- printTypeIndex("ElementType", AT.getElementType());
- printTypeIndex("IndexType", AT.getIndexType());
- W->printNumber("SizeOf", AT.getSize());
- W->printString("Name", AT.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, VFTableRecord &VFT) {
- printTypeIndex("CompleteClass", VFT.getCompleteClass());
- printTypeIndex("OverriddenVFTable", VFT.getOverriddenVTable());
- W->printHex("VFPtrOffset", VFT.getVFPtrOffset());
- W->printString("VFTableName", VFT.getName());
- for (auto N : VFT.getMethodNames())
- W->printString("MethodName", N);
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, MemberFuncIdRecord &Id) {
- printTypeIndex("ClassType", Id.getClassType());
- printTypeIndex("FunctionType", Id.getFunctionType());
- W->printString("Name", Id.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, ProcedureRecord &Proc) {
- printTypeIndex("ReturnType", Proc.getReturnType());
- W->printEnum("CallingConvention", uint8_t(Proc.getCallConv()),
- makeArrayRef(CallingConventions));
- W->printFlags("FunctionOptions", uint8_t(Proc.getOptions()),
- makeArrayRef(FunctionOptionEnum));
- W->printNumber("NumParameters", Proc.getParameterCount());
- printTypeIndex("ArgListType", Proc.getArgumentList());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, MemberFunctionRecord &MF) {
- printTypeIndex("ReturnType", MF.getReturnType());
- printTypeIndex("ClassType", MF.getClassType());
- printTypeIndex("ThisType", MF.getThisType());
- W->printEnum("CallingConvention", uint8_t(MF.getCallConv()),
- makeArrayRef(CallingConventions));
- W->printFlags("FunctionOptions", uint8_t(MF.getOptions()),
- makeArrayRef(FunctionOptionEnum));
- W->printNumber("NumParameters", MF.getParameterCount());
- printTypeIndex("ArgListType", MF.getArgumentList());
- W->printNumber("ThisAdjustment", MF.getThisPointerAdjustment());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR,
- MethodOverloadListRecord &MethodList) {
- for (auto &M : MethodList.getMethods()) {
- ListScope S(*W, "Method");
- printMemberAttributes(M.getAccess(), M.getMethodKind(), M.getOptions());
- printTypeIndex("Type", M.getType());
- if (M.isIntroducingVirtual())
- W->printHex("VFTableOffset", M.getVFTableOffset());
- }
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, FuncIdRecord &Func) {
- printTypeIndex("ParentScope", Func.getParentScope());
- printTypeIndex("FunctionType", Func.getFunctionType());
- W->printString("Name", Func.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, TypeServer2Record &TS) {
- W->printBinary("Signature", TS.getGuid());
- W->printNumber("Age", TS.getAge());
- W->printString("Name", TS.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
- printTypeIndex("PointeeType", Ptr.getReferentType());
- W->printHex("PointerAttributes", uint32_t(Ptr.getOptions()));
- W->printEnum("PtrType", unsigned(Ptr.getPointerKind()),
- makeArrayRef(PtrKindNames));
- W->printEnum("PtrMode", unsigned(Ptr.getMode()), makeArrayRef(PtrModeNames));
-
- W->printNumber("IsFlat", Ptr.isFlat());
- W->printNumber("IsConst", Ptr.isConst());
- W->printNumber("IsVolatile", Ptr.isVolatile());
- W->printNumber("IsUnaligned", Ptr.isUnaligned());
- W->printNumber("SizeOf", Ptr.getSize());
-
- if (Ptr.isPointerToMember()) {
- const MemberPointerInfo &MI = Ptr.getMemberInfo();
-
- printTypeIndex("ClassType", MI.getContainingType());
- W->printEnum("Representation", uint16_t(MI.getRepresentation()),
- makeArrayRef(PtrMemberRepNames));
- }
-
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, ModifierRecord &Mod) {
- uint16_t Mods = static_cast<uint16_t>(Mod.getModifiers());
- printTypeIndex("ModifiedType", Mod.getModifiedType());
- W->printFlags("Modifiers", Mods, makeArrayRef(TypeModifierNames));
-
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, BitFieldRecord &BitField) {
- printTypeIndex("Type", BitField.getType());
- W->printNumber("BitSize", BitField.getBitSize());
- W->printNumber("BitOffset", BitField.getBitOffset());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, VFTableShapeRecord &Shape) {
- W->printNumber("VFEntryCount", Shape.getEntryCount());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, UdtSourceLineRecord &Line) {
- printTypeIndex("UDT", Line.getUDT());
- printTypeIndex("SourceFile", Line.getSourceFile());
- W->printNumber("LineNumber", Line.getLineNumber());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR,
- UdtModSourceLineRecord &Line) {
- printTypeIndex("UDT", Line.getUDT());
- printTypeIndex("SourceFile", Line.getSourceFile());
- W->printNumber("LineNumber", Line.getLineNumber());
- W->printNumber("Module", Line.getModule());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownRecord(CVType &CVR, BuildInfoRecord &Args) {
- W->printNumber("NumArgs", static_cast<uint32_t>(Args.getArgs().size()));
-
- ListScope Arguments(*W, "Arguments");
- for (auto Arg : Args.getArgs()) {
- printTypeIndex("ArgType", Arg);
- }
- return Error::success();
-}
-
-void CVTypeDumper::printMemberAttributes(MemberAttributes Attrs) {
- return printMemberAttributes(Attrs.getAccess(), Attrs.getMethodKind(),
- Attrs.getFlags());
-}
-
-void CVTypeDumper::printMemberAttributes(MemberAccess Access, MethodKind Kind,
- MethodOptions Options) {
- W->printEnum("AccessSpecifier", uint8_t(Access),
- makeArrayRef(MemberAccessNames));
- // Data members will be vanilla. Don't try to print a method kind for them.
- if (Kind != MethodKind::Vanilla)
- W->printEnum("MethodKind", unsigned(Kind), makeArrayRef(MemberKindNames));
- if (Options != MethodOptions::None) {
- W->printFlags("MethodOptions", unsigned(Options),
- makeArrayRef(MethodOptionNames));
- }
-}
-
-Error CVTypeDumper::visitUnknownMember(CVMemberRecord &Record) {
- W->printHex("UnknownMember", unsigned(Record.Kind));
- return Error::success();
-}
-
-Error CVTypeDumper::visitUnknownType(CVType &Record) {
- W->printEnum("Kind", uint16_t(Record.kind()), makeArrayRef(LeafTypeNames));
- W->printNumber("Length", uint32_t(Record.content().size()));
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- NestedTypeRecord &Nested) {
- printTypeIndex("Type", Nested.getNestedType());
- W->printString("Name", Nested.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- OneMethodRecord &Method) {
- MethodKind K = Method.getMethodKind();
- printMemberAttributes(Method.getAccess(), K, Method.getOptions());
- printTypeIndex("Type", Method.getType());
- // If virtual, then read the vftable offset.
- if (Method.isIntroducingVirtual())
- W->printHex("VFTableOffset", Method.getVFTableOffset());
- W->printString("Name", Method.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- OverloadedMethodRecord &Method) {
- W->printHex("MethodCount", Method.getNumOverloads());
- printTypeIndex("MethodListIndex", Method.getMethodList());
- W->printString("Name", Method.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- DataMemberRecord &Field) {
- printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
- MethodOptions::None);
- printTypeIndex("Type", Field.getType());
- W->printHex("FieldOffset", Field.getFieldOffset());
- W->printString("Name", Field.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- StaticDataMemberRecord &Field) {
- printMemberAttributes(Field.getAccess(), MethodKind::Vanilla,
- MethodOptions::None);
- printTypeIndex("Type", Field.getType());
- W->printString("Name", Field.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- VFPtrRecord &VFTable) {
- printTypeIndex("Type", VFTable.getType());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- EnumeratorRecord &Enum) {
- printMemberAttributes(Enum.getAccess(), MethodKind::Vanilla,
- MethodOptions::None);
- W->printNumber("EnumValue", Enum.getValue());
- W->printString("Name", Enum.getName());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- BaseClassRecord &Base) {
- printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
- MethodOptions::None);
- printTypeIndex("BaseType", Base.getBaseType());
- W->printHex("BaseOffset", Base.getBaseOffset());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- VirtualBaseClassRecord &Base) {
- printMemberAttributes(Base.getAccess(), MethodKind::Vanilla,
- MethodOptions::None);
- printTypeIndex("BaseType", Base.getBaseType());
- printTypeIndex("VBPtrType", Base.getVBPtrType());
- W->printHex("VBPtrOffset", Base.getVBPtrOffset());
- W->printHex("VBTableIndex", Base.getVTableIndex());
- return Error::success();
-}
-
-Error CVTypeDumper::visitKnownMember(CVMemberRecord &CVR,
- ListContinuationRecord &Cont) {
- printTypeIndex("ContinuationIndex", Cont.getContinuationIndex());
- return Error::success();
-}
-
-void CVTypeDumper::printTypeIndex(StringRef FieldName, TypeIndex TI) {
- StringRef TypeName;
- if (!TI.isNoneType())
- TypeName = TypeDB.getTypeName(TI);
- if (!TypeName.empty())
- W->printHex(FieldName, TypeName, TI.getIndex());
- else
- W->printHex(FieldName, TI.getIndex());
-}
-
-Error CVTypeDumper::dump(const CVType &Record) {
- assert(W && "printer should not be null");
- TypeDatabaseVisitor DBV(TypeDB);
- TypeDeserializer Deserializer;
- TypeVisitorCallbackPipeline Pipeline;
- Pipeline.addCallbackToPipeline(Deserializer);
- Pipeline.addCallbackToPipeline(DBV);
- Pipeline.addCallbackToPipeline(*this);
-
- CVTypeVisitor Visitor(Pipeline);
-
- CVType RecordCopy = Record;
- if (auto EC = Visitor.visitTypeRecord(RecordCopy))
- return EC;
- return Error::success();
-}
-
-Error CVTypeDumper::dump(const CVTypeArray &Types) {
- assert(W && "printer should not be null");
- TypeDatabaseVisitor DBV(TypeDB);
- TypeDeserializer Deserializer;
- TypeVisitorCallbackPipeline Pipeline;
- Pipeline.addCallbackToPipeline(Deserializer);
- Pipeline.addCallbackToPipeline(DBV);
- Pipeline.addCallbackToPipeline(*this);
-
- CVTypeVisitor Visitor(Pipeline);
-
- if (auto EC = Visitor.visitTypeStream(Types))
- return EC;
- return Error::success();
-}
-
-Error CVTypeDumper::dump(ArrayRef<uint8_t> Data) {
- msf::ByteStream Stream(Data);
- CVTypeArray Types;
- msf::StreamReader Reader(Stream);
- if (auto EC = Reader.readArray(Types, Reader.getLength()))
- return EC;
-
- return dump(Types);
-}
-
-void CVTypeDumper::setPrinter(ScopedPrinter *P) {
- static ScopedPrinter NullP(llvm::nulls());
- W = P ? P : &NullP;
-}
Removed: llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.cpp (removed)
@@ -1,90 +0,0 @@
-//===- BuiltinDumper.cpp ---------------------------------------- *- C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "BuiltinDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-BuiltinDumper::BuiltinDumper(LinePrinter &P)
- : PDBSymDumper(false), Printer(P) {}
-
-void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
- WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol);
-}
-
-StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
- PDB_BuiltinType Type = Symbol.getBuiltinType();
- switch (Type) {
- case PDB_BuiltinType::Float:
- if (Symbol.getLength() == 4)
- return "float";
- return "double";
- case PDB_BuiltinType::UInt:
- switch (Symbol.getLength()) {
- case 8:
- return "unsigned __int64";
- case 4:
- return "unsigned int";
- case 2:
- return "unsigned short";
- case 1:
- return "unsigned char";
- default:
- return "unsigned";
- }
- case PDB_BuiltinType::Int:
- switch (Symbol.getLength()) {
- case 8:
- return "__int64";
- case 4:
- return "int";
- case 2:
- return "short";
- case 1:
- return "char";
- default:
- return "int";
- }
- case PDB_BuiltinType::Char:
- return "char";
- case PDB_BuiltinType::WCharT:
- return "wchar_t";
- case PDB_BuiltinType::Void:
- return "void";
- case PDB_BuiltinType::Long:
- return "long";
- case PDB_BuiltinType::ULong:
- return "unsigned long";
- case PDB_BuiltinType::Bool:
- return "bool";
- case PDB_BuiltinType::Currency:
- return "CURRENCY";
- case PDB_BuiltinType::Date:
- return "DATE";
- case PDB_BuiltinType::Variant:
- return "VARIANT";
- case PDB_BuiltinType::Complex:
- return "complex";
- case PDB_BuiltinType::Bitfield:
- return "bitfield";
- case PDB_BuiltinType::BSTR:
- return "BSTR";
- case PDB_BuiltinType::HResult:
- return "HRESULT";
- case PDB_BuiltinType::BCD:
- return "HRESULT";
- default:
- return "void";
- }
-}
Removed: llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/BuiltinDumper.h (removed)
@@ -1,35 +0,0 @@
-//===- BuiltinDumper.h ---------------------------------------- *- 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_LLVMPDBDUMP_BUILTINDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_BUILTINDUMPER_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-class BuiltinDumper : public PDBSymDumper {
-public:
- BuiltinDumper(LinePrinter &P);
-
- void start(const PDBSymbolTypeBuiltin &Symbol);
-
-private:
- StringRef getTypeName(const PDBSymbolTypeBuiltin &Symbol);
-
- LinePrinter &Printer;
-};
-}
-}
-
-#endif
Modified: llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-pdbdump/CMakeLists.txt Tue Jan 10 18:35:43 2017
@@ -8,20 +8,20 @@ set(LLVM_LINK_COMPONENTS
add_llvm_tool(llvm-pdbdump
llvm-pdbdump.cpp
- BuiltinDumper.cpp
- ClassDefinitionDumper.cpp
YamlSymbolDumper.cpp
YamlTypeDumper.cpp
- CompilandDumper.cpp
- EnumDumper.cpp
- ExternalSymbolDumper.cpp
- FunctionDumper.cpp
LinePrinter.cpp
LLVMOutputStyle.cpp
PdbYaml.cpp
- TypeDumper.cpp
- TypedefDumper.cpp
- VariableDumper.cpp
+ PrettyBuiltinDumper.cpp
+ PrettyClassDefinitionDumper.cpp
+ PrettyCompilandDumper.cpp
+ PrettyEnumDumper.cpp
+ PrettyExternalSymbolDumper.cpp
+ PrettyFunctionDumper.cpp
+ PrettyTypeDumper.cpp
+ PrettyTypedefDumper.cpp
+ PrettyVariableDumper.cpp
YAMLOutputStyle.cpp
)
Removed: llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.cpp (removed)
@@ -1,191 +0,0 @@
-//===- ClassDefinitionDumper.cpp --------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ClassDefinitionDumper.h"
-#include "EnumDumper.h"
-#include "FunctionDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-#include "TypedefDumper.h"
-#include "VariableDumper.h"
-
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.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/Support/Format.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-ClassDefinitionDumper::ClassDefinitionDumper(LinePrinter &P)
- : PDBSymDumper(true), Printer(P) {}
-
-void ClassDefinitionDumper::start(const PDBSymbolTypeUDT &Class) {
- std::string Name = Class.getName();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << Class.getUdtKind() << " ";
- WithColor(Printer, PDB_ColorItem::Type).get() << Class.getName();
-
- auto Bases = Class.findAllChildren<PDBSymbolTypeBaseClass>();
- if (Bases->getChildCount() > 0) {
- Printer.Indent();
- Printer.NewLine();
- Printer << ":";
- uint32_t BaseIndex = 0;
- while (auto Base = Bases->getNext()) {
- Printer << " ";
- WithColor(Printer, PDB_ColorItem::Keyword).get() << Base->getAccess();
- if (Base->isVirtualBaseClass())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << " virtual";
- WithColor(Printer, PDB_ColorItem::Type).get() << " " << Base->getName();
- if (++BaseIndex < Bases->getChildCount()) {
- Printer.NewLine();
- Printer << ",";
- }
- }
- Printer.Unindent();
- }
-
- Printer << " {";
- auto Children = Class.findAllChildren();
- if (Children->getChildCount() == 0) {
- Printer << "}";
- return;
- }
-
- // Try to dump symbols organized by member access level. Public members
- // first, then protected, then private. This might be slow, so it's worth
- // reconsidering the value of this if performance of large PDBs is a problem.
- // NOTE: Access level of nested types is not recorded in the PDB, so we have
- // a special case for them.
- SymbolGroupByAccess Groups;
- Groups.insert(std::make_pair(0, SymbolGroup()));
- Groups.insert(std::make_pair((int)PDB_MemberAccess::Private, SymbolGroup()));
- Groups.insert(
- std::make_pair((int)PDB_MemberAccess::Protected, SymbolGroup()));
- Groups.insert(std::make_pair((int)PDB_MemberAccess::Public, SymbolGroup()));
-
- while (auto Child = Children->getNext()) {
- PDB_MemberAccess Access = Child->getRawSymbol().getAccess();
- if (isa<PDBSymbolTypeBaseClass>(*Child))
- continue;
-
- auto &AccessGroup = Groups.find((int)Access)->second;
-
- if (auto Func = dyn_cast<PDBSymbolFunc>(Child.get())) {
- if (Func->isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
- continue;
- if (Func->getLength() == 0 && !Func->isPureVirtual() &&
- !Func->isIntroVirtualFunction())
- continue;
- Child.release();
- AccessGroup.Functions.push_back(std::unique_ptr<PDBSymbolFunc>(Func));
- } else if (auto Data = dyn_cast<PDBSymbolData>(Child.get())) {
- Child.release();
- AccessGroup.Data.push_back(std::unique_ptr<PDBSymbolData>(Data));
- } else {
- AccessGroup.Unknown.push_back(std::move(Child));
- }
- }
-
- int Count = 0;
- Count += dumpAccessGroup((PDB_MemberAccess)0, Groups[0]);
- Count += dumpAccessGroup(PDB_MemberAccess::Public,
- Groups[(int)PDB_MemberAccess::Public]);
- Count += dumpAccessGroup(PDB_MemberAccess::Protected,
- Groups[(int)PDB_MemberAccess::Protected]);
- Count += dumpAccessGroup(PDB_MemberAccess::Private,
- Groups[(int)PDB_MemberAccess::Private]);
- if (Count > 0)
- Printer.NewLine();
- Printer << "}";
-}
-
-int ClassDefinitionDumper::dumpAccessGroup(PDB_MemberAccess Access,
- const SymbolGroup &Group) {
- if (Group.Functions.empty() && Group.Data.empty() && Group.Unknown.empty())
- return 0;
-
- int Count = 0;
- if (Access == PDB_MemberAccess::Private) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "private";
- Printer << ":";
- } else if (Access == PDB_MemberAccess::Protected) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "protected";
- Printer << ":";
- } else if (Access == PDB_MemberAccess::Public) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "public";
- Printer << ":";
- }
- Printer.Indent();
- for (auto iter = Group.Functions.begin(), end = Group.Functions.end();
- iter != end; ++iter) {
- ++Count;
- (*iter)->dump(*this);
- }
- for (auto iter = Group.Data.begin(), end = Group.Data.end(); iter != end;
- ++iter) {
- ++Count;
- (*iter)->dump(*this);
- }
- for (auto iter = Group.Unknown.begin(), end = Group.Unknown.end();
- iter != end; ++iter) {
- ++Count;
- (*iter)->dump(*this);
- }
- Printer.Unindent();
- return Count;
-}
-
-void ClassDefinitionDumper::dump(const PDBSymbolTypeBaseClass &Symbol) {}
-
-void ClassDefinitionDumper::dump(const PDBSymbolData &Symbol) {
- VariableDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void ClassDefinitionDumper::dump(const PDBSymbolFunc &Symbol) {
- if (Printer.IsSymbolExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- FunctionDumper Dumper(Printer);
- Dumper.start(Symbol, FunctionDumper::PointerType::None);
-}
-
-void ClassDefinitionDumper::dump(const PDBSymbolTypeVTable &Symbol) {}
-
-void ClassDefinitionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
- if (Printer.IsTypeExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- EnumDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void ClassDefinitionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
- if (Printer.IsTypeExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- TypedefDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void ClassDefinitionDumper::dump(const PDBSymbolTypeUDT &Symbol) {}
Removed: llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/ClassDefinitionDumper.h (removed)
@@ -1,63 +0,0 @@
-//===- ClassDefinitionDumper.h - --------------------------------*- 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_LLVMPDBDUMP_CLASSDEFINITIONDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_CLASSDEFINITIONDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-
-#include <list>
-#include <memory>
-#include <unordered_map>
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-class ClassDefinitionDumper : public PDBSymDumper {
-public:
- ClassDefinitionDumper(LinePrinter &P);
-
- void start(const PDBSymbolTypeUDT &Exe);
-
- void dump(const PDBSymbolTypeBaseClass &Symbol) override;
- void dump(const PDBSymbolData &Symbol) override;
- void dump(const PDBSymbolTypeEnum &Symbol) override;
- void dump(const PDBSymbolFunc &Symbol) override;
- void dump(const PDBSymbolTypeTypedef &Symbol) override;
- void dump(const PDBSymbolTypeUDT &Symbol) override;
- void dump(const PDBSymbolTypeVTable &Symbol) override;
-
-private:
- LinePrinter &Printer;
-
- struct SymbolGroup {
- SymbolGroup() {}
- SymbolGroup(SymbolGroup &&Other) {
- Functions = std::move(Other.Functions);
- Data = std::move(Other.Data);
- Unknown = std::move(Other.Unknown);
- }
-
- std::list<std::unique_ptr<PDBSymbolFunc>> Functions;
- std::list<std::unique_ptr<PDBSymbolData>> Data;
- std::list<std::unique_ptr<PDBSymbol>> Unknown;
- SymbolGroup(const SymbolGroup &other) = delete;
- SymbolGroup &operator=(const SymbolGroup &other) = delete;
- };
- typedef std::unordered_map<int, SymbolGroup> SymbolGroupByAccess;
-
- int dumpAccessGroup(PDB_MemberAccess Access, const SymbolGroup &Group);
-};
-}
-}
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/CompilandDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompilandDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/CompilandDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/CompilandDumper.cpp (removed)
@@ -1,195 +0,0 @@
-//===- CompilandDumper.cpp - llvm-pdbdump compiland symbol dumper *- C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CompilandDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-
-#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
-#include "llvm/DebugInfo/PDB/IPDBLineNumber.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/PDBSymbolData.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/PDBSymbolThunk.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
-#include "llvm/Support/Format.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include "FunctionDumper.h"
-
-#include <utility>
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-CompilandDumper::CompilandDumper(LinePrinter &P)
- : PDBSymDumper(true), Printer(P) {}
-
-void CompilandDumper::dump(const PDBSymbolCompilandDetails &Symbol) {}
-
-void CompilandDumper::dump(const PDBSymbolCompilandEnv &Symbol) {}
-
-void CompilandDumper::start(const PDBSymbolCompiland &Symbol,
- CompilandDumpFlags opts) {
- std::string FullName = Symbol.getName();
- if (Printer.IsCompilandExcluded(FullName))
- return;
-
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Path).get() << FullName;
-
- if (opts & Flags::Lines) {
- const IPDBSession &Session = Symbol.getSession();
- auto Files = Session.getSourceFilesForCompiland(Symbol);
- Printer.Indent();
- while (auto File = Files->getNext()) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Path).get() << File->getFileName();
-
- auto Lines = Session.findLineNumbers(Symbol, *File);
- Printer.Indent();
- while (auto Line = Lines->getNext()) {
- Printer.NewLine();
- uint32_t LineStart = Line->getLineNumber();
- uint32_t LineEnd = Line->getLineNumberEnd();
-
- Printer << "Line ";
- PDB_ColorItem StatementColor = Line->isStatement()
- ? PDB_ColorItem::Keyword
- : PDB_ColorItem::LiteralValue;
- WithColor(Printer, StatementColor).get() << LineStart;
- if (LineStart != LineEnd)
- WithColor(Printer, StatementColor).get() << " - " << LineEnd;
-
- uint32_t ColumnStart = Line->getColumnNumber();
- uint32_t ColumnEnd = Line->getColumnNumberEnd();
- if (ColumnStart != 0 || ColumnEnd != 0) {
- Printer << ", Column: ";
- WithColor(Printer, StatementColor).get() << ColumnStart;
- if (ColumnEnd != ColumnStart)
- WithColor(Printer, StatementColor).get() << " - " << ColumnEnd;
- }
-
- Printer << ", Address: ";
- if (Line->getLength() > 0) {
- uint64_t AddrStart = Line->getVirtualAddress();
- uint64_t AddrEnd = AddrStart + Line->getLength() - 1;
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(AddrStart, 10) << " - "
- << format_hex(AddrEnd, 10) << "]";
- Printer << " (" << Line->getLength() << " bytes)";
- } else {
- uint64_t AddrStart = Line->getVirtualAddress();
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(AddrStart, 10) << "] ";
- Printer << "(0 bytes)";
- }
- }
- Printer.Unindent();
- }
- Printer.Unindent();
- }
-
- if (opts & Flags::Children) {
- auto ChildrenEnum = Symbol.findAllChildren();
- Printer.Indent();
- while (auto Child = ChildrenEnum->getNext())
- Child->dump(*this);
- Printer.Unindent();
- }
-}
-
-void CompilandDumper::dump(const PDBSymbolData &Symbol) {
- if (Printer.IsSymbolExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
-
- switch (auto LocType = Symbol.getLocationType()) {
- case PDB_LocType::Static:
- Printer << "data: ";
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(Symbol.getVirtualAddress(), 10) << "]";
- break;
- case PDB_LocType::Constant:
- Printer << "constant: ";
- WithColor(Printer, PDB_ColorItem::LiteralValue).get()
- << "[" << Symbol.getValue() << "]";
- break;
- default:
- Printer << "data(unexpected type=" << LocType << ")";
- }
-
- Printer << " ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
-}
-
-void CompilandDumper::dump(const PDBSymbolFunc &Symbol) {
- if (Symbol.getLength() == 0)
- return;
- if (Printer.IsSymbolExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- FunctionDumper Dumper(Printer);
- Dumper.start(Symbol, FunctionDumper::PointerType::None);
-}
-
-void CompilandDumper::dump(const PDBSymbolLabel &Symbol) {
- if (Printer.IsSymbolExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- Printer << "label ";
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(Symbol.getVirtualAddress(), 10) << "] ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
-}
-
-void CompilandDumper::dump(const PDBSymbolThunk &Symbol) {
- if (Printer.IsSymbolExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- Printer << "thunk ";
- codeview::ThunkOrdinal Ordinal = Symbol.getThunkOrdinal();
- uint64_t VA = Symbol.getVirtualAddress();
- if (Ordinal == codeview::ThunkOrdinal::TrampIncremental) {
- uint64_t Target = Symbol.getTargetVirtualAddress();
- WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(VA, 10);
- Printer << " -> ";
- WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Target, 10);
- } else {
- WithColor(Printer, PDB_ColorItem::Address).get()
- << "[" << format_hex(VA, 10) << " - "
- << format_hex(VA + Symbol.getLength(), 10) << "]";
- }
- Printer << " (";
- WithColor(Printer, PDB_ColorItem::Register).get() << Ordinal;
- Printer << ") ";
- std::string Name = Symbol.getName();
- if (!Name.empty())
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Name;
-}
-
-void CompilandDumper::dump(const PDBSymbolTypeTypedef &Symbol) {}
-
-void CompilandDumper::dump(const PDBSymbolUnknown &Symbol) {
- Printer.NewLine();
- Printer << "unknown (" << Symbol.getSymTag() << ")";
-}
Removed: llvm/trunk/tools/llvm-pdbdump/CompilandDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/CompilandDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/CompilandDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/CompilandDumper.h (removed)
@@ -1,44 +0,0 @@
-//===- CompilandDumper.h - llvm-pdbdump compiland symbol dumper *- 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_LLVMPDBDUMP_COMPILANDDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_COMPILANDDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-typedef int CompilandDumpFlags;
-class CompilandDumper : public PDBSymDumper {
-public:
- enum Flags { None = 0x0, Children = 0x1, Symbols = 0x2, Lines = 0x4 };
-
- CompilandDumper(LinePrinter &P);
-
- void start(const PDBSymbolCompiland &Symbol, CompilandDumpFlags flags);
-
- void dump(const PDBSymbolCompilandDetails &Symbol) override;
- void dump(const PDBSymbolCompilandEnv &Symbol) override;
- void dump(const PDBSymbolData &Symbol) override;
- void dump(const PDBSymbolFunc &Symbol) override;
- void dump(const PDBSymbolLabel &Symbol) override;
- void dump(const PDBSymbolThunk &Symbol) override;
- void dump(const PDBSymbolTypeTypedef &Symbol) override;
- void dump(const PDBSymbolUnknown &Symbol) override;
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/EnumDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/EnumDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/EnumDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/EnumDumper.cpp (removed)
@@ -1,53 +0,0 @@
-//===- EnumDumper.cpp -------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "EnumDumper.h"
-
-#include "BuiltinDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-EnumDumper::EnumDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
-
-void EnumDumper::start(const PDBSymbolTypeEnum &Symbol) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
- if (!opts::pretty::NoEnumDefs) {
- auto BuiltinType = Symbol.getUnderlyingType();
- if (BuiltinType->getBuiltinType() != PDB_BuiltinType::Int ||
- BuiltinType->getLength() != 4) {
- Printer << " : ";
- BuiltinDumper Dumper(Printer);
- Dumper.start(*BuiltinType);
- }
- Printer << " {";
- Printer.Indent();
- auto EnumValues = Symbol.findAllChildren<PDBSymbolData>();
- while (auto EnumValue = EnumValues->getNext()) {
- if (EnumValue->getDataKind() != PDB_DataKind::Constant)
- continue;
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Identifier).get()
- << EnumValue->getName();
- Printer << " = ";
- WithColor(Printer, PDB_ColorItem::LiteralValue).get()
- << EnumValue->getValue();
- }
- Printer.Unindent();
- Printer.NewLine();
- Printer << "}";
- }
-}
Removed: llvm/trunk/tools/llvm-pdbdump/EnumDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/EnumDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/EnumDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/EnumDumper.h (removed)
@@ -1,31 +0,0 @@
-//===- EnumDumper.h - -------------------------------------------*- 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_LLVMPDBDUMP_ENUMDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_ENUMDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-class EnumDumper : public PDBSymDumper {
-public:
- EnumDumper(LinePrinter &P);
-
- void start(const PDBSymbolTypeEnum &Symbol);
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.cpp (removed)
@@ -1,41 +0,0 @@
-//===- ExternalSymbolDumper.cpp -------------------------------- *- C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ExternalSymbolDumper.h"
-#include "LinePrinter.h"
-
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
- : PDBSymDumper(true), Printer(P) {}
-
-void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
- auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
- while (auto Var = Vars->getNext())
- Var->dump(*this);
-}
-
-void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
- std::string LinkageName = Symbol.getName();
- if (Printer.IsSymbolExcluded(LinkageName))
- return;
-
- Printer.NewLine();
- uint64_t Addr = Symbol.getVirtualAddress();
-
- Printer << "[";
- WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
- Printer << "] ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
-}
Removed: llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/ExternalSymbolDumper.h (removed)
@@ -1,34 +0,0 @@
-//===- ExternalSymbolDumper.h --------------------------------- *- 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_LLVMPDBDUMP_EXTERNALSYMBOLDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_EXTERNALSYMBOLDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-class ExternalSymbolDumper : public PDBSymDumper {
-public:
- ExternalSymbolDumper(LinePrinter &P);
-
- void start(const PDBSymbolExe &Symbol);
-
- void dump(const PDBSymbolPublicSymbol &Symbol) override;
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/FunctionDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/FunctionDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/FunctionDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/FunctionDumper.cpp (removed)
@@ -1,257 +0,0 @@
-//===- FunctionDumper.cpp ------------------------------------ *- C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "FunctionDumper.h"
-#include "BuiltinDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-using namespace llvm::codeview;
-using namespace llvm::pdb;
-
-namespace {
-template <class T>
-void dumpClassParentWithScopeOperator(const T &Symbol, LinePrinter &Printer,
- FunctionDumper &Dumper) {
- uint32_t ClassParentId = Symbol.getClassParentId();
- auto ClassParent =
- Symbol.getSession().template getConcreteSymbolById<PDBSymbolTypeUDT>(
- ClassParentId);
- if (!ClassParent)
- return;
-
- WithColor(Printer, PDB_ColorItem::Type).get() << ClassParent->getName();
- Printer << "::";
-}
-}
-
-FunctionDumper::FunctionDumper(LinePrinter &P)
- : PDBSymDumper(true), Printer(P) {}
-
-void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
- const char *Name, PointerType Pointer) {
- auto ReturnType = Symbol.getReturnType();
- ReturnType->dump(*this);
- Printer << " ";
- uint32_t ClassParentId = Symbol.getClassParentId();
- auto ClassParent =
- Symbol.getSession().getConcreteSymbolById<PDBSymbolTypeUDT>(
- ClassParentId);
-
- PDB_CallingConv CC = Symbol.getCallingConvention();
- bool ShouldDumpCallingConvention = true;
- if ((ClassParent && CC == CallingConvention::ThisCall) ||
- (!ClassParent && CC == CallingConvention::NearStdCall)) {
- ShouldDumpCallingConvention = false;
- }
-
- if (Pointer == PointerType::None) {
- if (ShouldDumpCallingConvention)
- WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " ";
- if (ClassParent) {
- Printer << "(";
- WithColor(Printer, PDB_ColorItem::Identifier).get()
- << ClassParent->getName();
- Printer << "::)";
- }
- } else {
- Printer << "(";
- if (ShouldDumpCallingConvention)
- WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " ";
- if (ClassParent) {
- WithColor(Printer, PDB_ColorItem::Identifier).get()
- << ClassParent->getName();
- Printer << "::";
- }
- if (Pointer == PointerType::Reference)
- Printer << "&";
- else
- Printer << "*";
- if (Name)
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Name;
- Printer << ")";
- }
-
- Printer << "(";
- if (auto ChildEnum = Symbol.getArguments()) {
- uint32_t Index = 0;
- while (auto Arg = ChildEnum->getNext()) {
- Arg->dump(*this);
- if (++Index < ChildEnum->getChildCount())
- Printer << ", ";
- }
- }
- Printer << ")";
-
- if (Symbol.isConstType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << " const";
- if (Symbol.isVolatileType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
-}
-
-void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer) {
- uint64_t FuncStart = Symbol.getVirtualAddress();
- uint64_t FuncEnd = FuncStart + Symbol.getLength();
-
- Printer << "func [";
- WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncStart, 10);
- if (auto DebugStart = Symbol.findOneChild<PDBSymbolFuncDebugStart>()) {
- uint64_t Prologue = DebugStart->getVirtualAddress() - FuncStart;
- WithColor(Printer, PDB_ColorItem::Offset).get() << "+" << Prologue;
- }
- Printer << " - ";
- WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncEnd, 10);
- if (auto DebugEnd = Symbol.findOneChild<PDBSymbolFuncDebugEnd>()) {
- uint64_t Epilogue = FuncEnd - DebugEnd->getVirtualAddress();
- WithColor(Printer, PDB_ColorItem::Offset).get() << "-" << Epilogue;
- }
- Printer << "] (";
-
- if (Symbol.hasFramePointer()) {
- WithColor(Printer, PDB_ColorItem::Register).get()
- << Symbol.getLocalBasePointerRegisterId();
- } else {
- WithColor(Printer, PDB_ColorItem::Register).get() << "FPO";
- }
- Printer << ") ";
-
- if (Symbol.isVirtual() || Symbol.isPureVirtual())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "virtual ";
-
- auto Signature = Symbol.getSignature();
- if (!Signature) {
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
- if (Pointer == PointerType::Pointer)
- Printer << "*";
- else if (Pointer == FunctionDumper::PointerType::Reference)
- Printer << "&";
- return;
- }
-
- auto ReturnType = Signature->getReturnType();
- ReturnType->dump(*this);
- Printer << " ";
-
- auto ClassParent = Symbol.getClassParent();
- CallingConvention CC = Signature->getCallingConvention();
- if (Pointer != FunctionDumper::PointerType::None)
- Printer << "(";
-
- if ((ClassParent && CC != CallingConvention::ThisCall) ||
- (!ClassParent && CC != CallingConvention::NearStdCall)) {
- WithColor(Printer, PDB_ColorItem::Keyword).get()
- << Signature->getCallingConvention() << " ";
- }
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
- if (Pointer != FunctionDumper::PointerType::None) {
- if (Pointer == PointerType::Pointer)
- Printer << "*";
- else if (Pointer == FunctionDumper::PointerType::Reference)
- Printer << "&";
- Printer << ")";
- }
-
- Printer << "(";
- if (auto Arguments = Symbol.getArguments()) {
- uint32_t Index = 0;
- while (auto Arg = Arguments->getNext()) {
- auto ArgType = Arg->getType();
- ArgType->dump(*this);
- WithColor(Printer, PDB_ColorItem::Identifier).get() << " "
- << Arg->getName();
- if (++Index < Arguments->getChildCount())
- Printer << ", ";
- }
- }
- Printer << ")";
- if (Symbol.isConstType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << " const";
- if (Symbol.isVolatileType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
- if (Symbol.isPureVirtual())
- Printer << " = 0";
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol) {
- uint32_t ElementTypeId = Symbol.getTypeId();
- auto ElementType = Symbol.getSession().getSymbolById(ElementTypeId);
- if (!ElementType)
- return;
-
- ElementType->dump(*this);
- Printer << "[";
- WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Symbol.getLength();
- Printer << "]";
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
- BuiltinDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
- dumpClassParentWithScopeOperator(Symbol, Printer, *this);
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeFunctionArg &Symbol) {
- // PDBSymbolTypeFunctionArg is just a shim over the real argument. Just drill
- // through to the real thing and dump it.
- uint32_t TypeId = Symbol.getTypeId();
- auto Type = Symbol.getSession().getSymbolById(TypeId);
- if (!Type)
- return;
- Type->dump(*this);
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
- dumpClassParentWithScopeOperator(Symbol, Printer, *this);
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
-
-void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol) {
- uint32_t PointeeId = Symbol.getTypeId();
- auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
- if (!PointeeType)
- return;
-
- if (auto FuncSig = dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
- FunctionDumper NestedDumper(Printer);
- PointerType Pointer =
- Symbol.isReference() ? PointerType::Reference : PointerType::Pointer;
- NestedDumper.start(*FuncSig, nullptr, Pointer);
- } else {
- if (Symbol.isConstType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
- if (Symbol.isVolatileType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
- PointeeType->dump(*this);
- Printer << (Symbol.isReference() ? "&" : "*");
- }
-}
-
-void FunctionDumper::dump(const PDBSymbolTypeUDT &Symbol) {
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
Removed: llvm/trunk/tools/llvm-pdbdump/FunctionDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/FunctionDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/FunctionDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/FunctionDumper.h (removed)
@@ -1,43 +0,0 @@
-//===- FunctionDumper.h --------------------------------------- *- 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_LLVMPDBDUMP_FUNCTIONDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_FUNCTIONDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-class LinePrinter;
-
-class FunctionDumper : public PDBSymDumper {
-public:
- FunctionDumper(LinePrinter &P);
-
- enum class PointerType { None, Pointer, Reference };
-
- void start(const PDBSymbolTypeFunctionSig &Symbol, const char *Name,
- PointerType Pointer);
- void start(const PDBSymbolFunc &Symbol, PointerType Pointer);
-
- void dump(const PDBSymbolTypeArray &Symbol) override;
- void dump(const PDBSymbolTypeBuiltin &Symbol) override;
- void dump(const PDBSymbolTypeEnum &Symbol) override;
- void dump(const PDBSymbolTypeFunctionArg &Symbol) override;
- void dump(const PDBSymbolTypePointer &Symbol) override;
- void dump(const PDBSymbolTypeTypedef &Symbol) override;
- void dump(const PDBSymbolTypeUDT &Symbol) override;
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-
-#endif
Modified: llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.h?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/LLVMOutputStyle.h Tue Jan 10 18:35:43 2017
@@ -12,7 +12,7 @@
#include "OutputStyle.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/Support/ScopedPrinter.h"
namespace llvm {
Added: llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,90 @@
+//===- PrettyBuiltinDumper.cpp ---------------------------------- *- C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyBuiltinDumper.h"
+#include "LinePrinter.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+BuiltinDumper::BuiltinDumper(LinePrinter &P)
+ : PDBSymDumper(false), Printer(P) {}
+
+void BuiltinDumper::start(const PDBSymbolTypeBuiltin &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Type).get() << getTypeName(Symbol);
+}
+
+StringRef BuiltinDumper::getTypeName(const PDBSymbolTypeBuiltin &Symbol) {
+ PDB_BuiltinType Type = Symbol.getBuiltinType();
+ switch (Type) {
+ case PDB_BuiltinType::Float:
+ if (Symbol.getLength() == 4)
+ return "float";
+ return "double";
+ case PDB_BuiltinType::UInt:
+ switch (Symbol.getLength()) {
+ case 8:
+ return "unsigned __int64";
+ case 4:
+ return "unsigned int";
+ case 2:
+ return "unsigned short";
+ case 1:
+ return "unsigned char";
+ default:
+ return "unsigned";
+ }
+ case PDB_BuiltinType::Int:
+ switch (Symbol.getLength()) {
+ case 8:
+ return "__int64";
+ case 4:
+ return "int";
+ case 2:
+ return "short";
+ case 1:
+ return "char";
+ default:
+ return "int";
+ }
+ case PDB_BuiltinType::Char:
+ return "char";
+ case PDB_BuiltinType::WCharT:
+ return "wchar_t";
+ case PDB_BuiltinType::Void:
+ return "void";
+ case PDB_BuiltinType::Long:
+ return "long";
+ case PDB_BuiltinType::ULong:
+ return "unsigned long";
+ case PDB_BuiltinType::Bool:
+ return "bool";
+ case PDB_BuiltinType::Currency:
+ return "CURRENCY";
+ case PDB_BuiltinType::Date:
+ return "DATE";
+ case PDB_BuiltinType::Variant:
+ return "VARIANT";
+ case PDB_BuiltinType::Complex:
+ return "complex";
+ case PDB_BuiltinType::Bitfield:
+ return "bitfield";
+ case PDB_BuiltinType::BSTR:
+ return "BSTR";
+ case PDB_BuiltinType::HResult:
+ return "HRESULT";
+ case PDB_BuiltinType::BCD:
+ return "HRESULT";
+ default:
+ return "void";
+ }
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyBuiltinDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,35 @@
+//===- PrettyBuiltinDumper.h ---------------------------------- *- 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_LLVMPDBDUMP_PRETTYBUILTINDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYBUILTINDUMPER_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+class BuiltinDumper : public PDBSymDumper {
+public:
+ BuiltinDumper(LinePrinter &P);
+
+ void start(const PDBSymbolTypeBuiltin &Symbol);
+
+private:
+ StringRef getTypeName(const PDBSymbolTypeBuiltin &Symbol);
+
+ LinePrinter &Printer;
+};
+}
+}
+
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,192 @@
+//===- PrettyClassDefinitionDumper.cpp --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyClassDefinitionDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyEnumDumper.h"
+#include "PrettyFunctionDumper.h"
+#include "PrettyTypedefDumper.h"
+#include "PrettyVariableDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.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/Support/Format.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+ClassDefinitionDumper::ClassDefinitionDumper(LinePrinter &P)
+ : PDBSymDumper(true), Printer(P) {}
+
+void ClassDefinitionDumper::start(const PDBSymbolTypeUDT &Class) {
+ std::string Name = Class.getName();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << Class.getUdtKind() << " ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Class.getName();
+
+ auto Bases = Class.findAllChildren<PDBSymbolTypeBaseClass>();
+ if (Bases->getChildCount() > 0) {
+ Printer.Indent();
+ Printer.NewLine();
+ Printer << ":";
+ uint32_t BaseIndex = 0;
+ while (auto Base = Bases->getNext()) {
+ Printer << " ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << Base->getAccess();
+ if (Base->isVirtualBaseClass())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " virtual";
+ WithColor(Printer, PDB_ColorItem::Type).get() << " " << Base->getName();
+ if (++BaseIndex < Bases->getChildCount()) {
+ Printer.NewLine();
+ Printer << ",";
+ }
+ }
+ Printer.Unindent();
+ }
+
+ Printer << " {";
+ auto Children = Class.findAllChildren();
+ if (Children->getChildCount() == 0) {
+ Printer << "}";
+ return;
+ }
+
+ // Try to dump symbols organized by member access level. Public members
+ // first, then protected, then private. This might be slow, so it's worth
+ // reconsidering the value of this if performance of large PDBs is a problem.
+ // NOTE: Access level of nested types is not recorded in the PDB, so we have
+ // a special case for them.
+ SymbolGroupByAccess Groups;
+ Groups.insert(std::make_pair(0, SymbolGroup()));
+ Groups.insert(std::make_pair((int)PDB_MemberAccess::Private, SymbolGroup()));
+ Groups.insert(
+ std::make_pair((int)PDB_MemberAccess::Protected, SymbolGroup()));
+ Groups.insert(std::make_pair((int)PDB_MemberAccess::Public, SymbolGroup()));
+
+ while (auto Child = Children->getNext()) {
+ PDB_MemberAccess Access = Child->getRawSymbol().getAccess();
+ if (isa<PDBSymbolTypeBaseClass>(*Child))
+ continue;
+
+ auto &AccessGroup = Groups.find((int)Access)->second;
+
+ if (auto Func = dyn_cast<PDBSymbolFunc>(Child.get())) {
+ if (Func->isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
+ continue;
+ if (Func->getLength() == 0 && !Func->isPureVirtual() &&
+ !Func->isIntroVirtualFunction())
+ continue;
+ Child.release();
+ AccessGroup.Functions.push_back(std::unique_ptr<PDBSymbolFunc>(Func));
+ } else if (auto Data = dyn_cast<PDBSymbolData>(Child.get())) {
+ Child.release();
+ AccessGroup.Data.push_back(std::unique_ptr<PDBSymbolData>(Data));
+ } else {
+ AccessGroup.Unknown.push_back(std::move(Child));
+ }
+ }
+
+ int Count = 0;
+ Count += dumpAccessGroup((PDB_MemberAccess)0, Groups[0]);
+ Count += dumpAccessGroup(PDB_MemberAccess::Public,
+ Groups[(int)PDB_MemberAccess::Public]);
+ Count += dumpAccessGroup(PDB_MemberAccess::Protected,
+ Groups[(int)PDB_MemberAccess::Protected]);
+ Count += dumpAccessGroup(PDB_MemberAccess::Private,
+ Groups[(int)PDB_MemberAccess::Private]);
+ if (Count > 0)
+ Printer.NewLine();
+ Printer << "}";
+}
+
+int ClassDefinitionDumper::dumpAccessGroup(PDB_MemberAccess Access,
+ const SymbolGroup &Group) {
+ if (Group.Functions.empty() && Group.Data.empty() && Group.Unknown.empty())
+ return 0;
+
+ int Count = 0;
+ if (Access == PDB_MemberAccess::Private) {
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "private";
+ Printer << ":";
+ } else if (Access == PDB_MemberAccess::Protected) {
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "protected";
+ Printer << ":";
+ } else if (Access == PDB_MemberAccess::Public) {
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "public";
+ Printer << ":";
+ }
+ Printer.Indent();
+ for (auto iter = Group.Functions.begin(), end = Group.Functions.end();
+ iter != end; ++iter) {
+ ++Count;
+ (*iter)->dump(*this);
+ }
+ for (auto iter = Group.Data.begin(), end = Group.Data.end(); iter != end;
+ ++iter) {
+ ++Count;
+ (*iter)->dump(*this);
+ }
+ for (auto iter = Group.Unknown.begin(), end = Group.Unknown.end();
+ iter != end; ++iter) {
+ ++Count;
+ (*iter)->dump(*this);
+ }
+ Printer.Unindent();
+ return Count;
+}
+
+void ClassDefinitionDumper::dump(const PDBSymbolTypeBaseClass &Symbol) {}
+
+void ClassDefinitionDumper::dump(const PDBSymbolData &Symbol) {
+ VariableDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void ClassDefinitionDumper::dump(const PDBSymbolFunc &Symbol) {
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ FunctionDumper Dumper(Printer);
+ Dumper.start(Symbol, FunctionDumper::PointerType::None);
+}
+
+void ClassDefinitionDumper::dump(const PDBSymbolTypeVTable &Symbol) {}
+
+void ClassDefinitionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
+ if (Printer.IsTypeExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ EnumDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void ClassDefinitionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
+ if (Printer.IsTypeExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ TypedefDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void ClassDefinitionDumper::dump(const PDBSymbolTypeUDT &Symbol) {}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyClassDefinitionDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,63 @@
+//===- PrettyClassDefinitionDumper.h ----------------------------*- 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_LLVMPDBDUMP_PRETTYCLASSDEFINITIONDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYCLASSDEFINITIONDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+
+#include <list>
+#include <memory>
+#include <unordered_map>
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+class ClassDefinitionDumper : public PDBSymDumper {
+public:
+ ClassDefinitionDumper(LinePrinter &P);
+
+ void start(const PDBSymbolTypeUDT &Exe);
+
+ void dump(const PDBSymbolTypeBaseClass &Symbol) override;
+ void dump(const PDBSymbolData &Symbol) override;
+ void dump(const PDBSymbolTypeEnum &Symbol) override;
+ void dump(const PDBSymbolFunc &Symbol) override;
+ void dump(const PDBSymbolTypeTypedef &Symbol) override;
+ void dump(const PDBSymbolTypeUDT &Symbol) override;
+ void dump(const PDBSymbolTypeVTable &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+
+ struct SymbolGroup {
+ SymbolGroup() {}
+ SymbolGroup(SymbolGroup &&Other) {
+ Functions = std::move(Other.Functions);
+ Data = std::move(Other.Data);
+ Unknown = std::move(Other.Unknown);
+ }
+
+ std::list<std::unique_ptr<PDBSymbolFunc>> Functions;
+ std::list<std::unique_ptr<PDBSymbolData>> Data;
+ std::list<std::unique_ptr<PDBSymbol>> Unknown;
+ SymbolGroup(const SymbolGroup &other) = delete;
+ SymbolGroup &operator=(const SymbolGroup &other) = delete;
+ };
+ typedef std::unordered_map<int, SymbolGroup> SymbolGroupByAccess;
+
+ int dumpAccessGroup(PDB_MemberAccess Access, const SymbolGroup &Group);
+};
+}
+}
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,195 @@
+//===- PrettyCompilandDumper.cpp - llvm-pdbdump compiland dumper -*- C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyCompilandDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyFunctionDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBLineNumber.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/PDBSymbolData.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/PDBSymbolThunk.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include <utility>
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+CompilandDumper::CompilandDumper(LinePrinter &P)
+ : PDBSymDumper(true), Printer(P) {}
+
+void CompilandDumper::dump(const PDBSymbolCompilandDetails &Symbol) {}
+
+void CompilandDumper::dump(const PDBSymbolCompilandEnv &Symbol) {}
+
+void CompilandDumper::start(const PDBSymbolCompiland &Symbol,
+ CompilandDumpFlags opts) {
+ std::string FullName = Symbol.getName();
+ if (Printer.IsCompilandExcluded(FullName))
+ return;
+
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Path).get() << FullName;
+
+ if (opts & Flags::Lines) {
+ const IPDBSession &Session = Symbol.getSession();
+ auto Files = Session.getSourceFilesForCompiland(Symbol);
+ Printer.Indent();
+ while (auto File = Files->getNext()) {
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Path).get() << File->getFileName();
+
+ auto Lines = Session.findLineNumbers(Symbol, *File);
+ Printer.Indent();
+ while (auto Line = Lines->getNext()) {
+ Printer.NewLine();
+ uint32_t LineStart = Line->getLineNumber();
+ uint32_t LineEnd = Line->getLineNumberEnd();
+
+ Printer << "Line ";
+ PDB_ColorItem StatementColor = Line->isStatement()
+ ? PDB_ColorItem::Keyword
+ : PDB_ColorItem::LiteralValue;
+ WithColor(Printer, StatementColor).get() << LineStart;
+ if (LineStart != LineEnd)
+ WithColor(Printer, StatementColor).get() << " - " << LineEnd;
+
+ uint32_t ColumnStart = Line->getColumnNumber();
+ uint32_t ColumnEnd = Line->getColumnNumberEnd();
+ if (ColumnStart != 0 || ColumnEnd != 0) {
+ Printer << ", Column: ";
+ WithColor(Printer, StatementColor).get() << ColumnStart;
+ if (ColumnEnd != ColumnStart)
+ WithColor(Printer, StatementColor).get() << " - " << ColumnEnd;
+ }
+
+ Printer << ", Address: ";
+ if (Line->getLength() > 0) {
+ uint64_t AddrStart = Line->getVirtualAddress();
+ uint64_t AddrEnd = AddrStart + Line->getLength() - 1;
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << "[" << format_hex(AddrStart, 10) << " - "
+ << format_hex(AddrEnd, 10) << "]";
+ Printer << " (" << Line->getLength() << " bytes)";
+ } else {
+ uint64_t AddrStart = Line->getVirtualAddress();
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << "[" << format_hex(AddrStart, 10) << "] ";
+ Printer << "(0 bytes)";
+ }
+ }
+ Printer.Unindent();
+ }
+ Printer.Unindent();
+ }
+
+ if (opts & Flags::Children) {
+ auto ChildrenEnum = Symbol.findAllChildren();
+ Printer.Indent();
+ while (auto Child = ChildrenEnum->getNext())
+ Child->dump(*this);
+ Printer.Unindent();
+ }
+}
+
+void CompilandDumper::dump(const PDBSymbolData &Symbol) {
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+
+ switch (auto LocType = Symbol.getLocationType()) {
+ case PDB_LocType::Static:
+ Printer << "data: ";
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << "[" << format_hex(Symbol.getVirtualAddress(), 10) << "]";
+ break;
+ case PDB_LocType::Constant:
+ Printer << "constant: ";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get()
+ << "[" << Symbol.getValue() << "]";
+ break;
+ default:
+ Printer << "data(unexpected type=" << LocType << ")";
+ }
+
+ Printer << " ";
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+}
+
+void CompilandDumper::dump(const PDBSymbolFunc &Symbol) {
+ if (Symbol.getLength() == 0)
+ return;
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ FunctionDumper Dumper(Printer);
+ Dumper.start(Symbol, FunctionDumper::PointerType::None);
+}
+
+void CompilandDumper::dump(const PDBSymbolLabel &Symbol) {
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ Printer << "label ";
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << "[" << format_hex(Symbol.getVirtualAddress(), 10) << "] ";
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+}
+
+void CompilandDumper::dump(const PDBSymbolThunk &Symbol) {
+ if (Printer.IsSymbolExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ Printer << "thunk ";
+ codeview::ThunkOrdinal Ordinal = Symbol.getThunkOrdinal();
+ uint64_t VA = Symbol.getVirtualAddress();
+ if (Ordinal == codeview::ThunkOrdinal::TrampIncremental) {
+ uint64_t Target = Symbol.getTargetVirtualAddress();
+ WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(VA, 10);
+ Printer << " -> ";
+ WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Target, 10);
+ } else {
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << "[" << format_hex(VA, 10) << " - "
+ << format_hex(VA + Symbol.getLength(), 10) << "]";
+ }
+ Printer << " (";
+ WithColor(Printer, PDB_ColorItem::Register).get() << Ordinal;
+ Printer << ") ";
+ std::string Name = Symbol.getName();
+ if (!Name.empty())
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Name;
+}
+
+void CompilandDumper::dump(const PDBSymbolTypeTypedef &Symbol) {}
+
+void CompilandDumper::dump(const PDBSymbolUnknown &Symbol) {
+ Printer.NewLine();
+ Printer << "unknown (" << Symbol.getSymTag() << ")";
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyCompilandDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,44 @@
+//===- PrettyCompilandDumper.h - llvm-pdbdump compiland dumper -*- 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_LLVMPDBDUMP_PRETTYCOMPILANDDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYCOMPILANDDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+typedef int CompilandDumpFlags;
+class CompilandDumper : public PDBSymDumper {
+public:
+ enum Flags { None = 0x0, Children = 0x1, Symbols = 0x2, Lines = 0x4 };
+
+ CompilandDumper(LinePrinter &P);
+
+ void start(const PDBSymbolCompiland &Symbol, CompilandDumpFlags flags);
+
+ void dump(const PDBSymbolCompilandDetails &Symbol) override;
+ void dump(const PDBSymbolCompilandEnv &Symbol) override;
+ void dump(const PDBSymbolData &Symbol) override;
+ void dump(const PDBSymbolFunc &Symbol) override;
+ void dump(const PDBSymbolLabel &Symbol) override;
+ void dump(const PDBSymbolThunk &Symbol) override;
+ void dump(const PDBSymbolTypeTypedef &Symbol) override;
+ void dump(const PDBSymbolUnknown &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,53 @@
+//===- PrettyEnumDumper.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyEnumDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyBuiltinDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+EnumDumper::EnumDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
+
+void EnumDumper::start(const PDBSymbolTypeEnum &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+ if (!opts::pretty::NoEnumDefs) {
+ auto BuiltinType = Symbol.getUnderlyingType();
+ if (BuiltinType->getBuiltinType() != PDB_BuiltinType::Int ||
+ BuiltinType->getLength() != 4) {
+ Printer << " : ";
+ BuiltinDumper Dumper(Printer);
+ Dumper.start(*BuiltinType);
+ }
+ Printer << " {";
+ Printer.Indent();
+ auto EnumValues = Symbol.findAllChildren<PDBSymbolData>();
+ while (auto EnumValue = EnumValues->getNext()) {
+ if (EnumValue->getDataKind() != PDB_DataKind::Constant)
+ continue;
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Identifier).get()
+ << EnumValue->getName();
+ Printer << " = ";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get()
+ << EnumValue->getValue();
+ }
+ Printer.Unindent();
+ Printer.NewLine();
+ Printer << "}";
+ }
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyEnumDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,31 @@
+//===- PrettyEnumDumper.h ---------------------------------------*- 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_LLVMPDBDUMP_PRETTYENUMDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYENUMDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+class EnumDumper : public PDBSymDumper {
+public:
+ EnumDumper(LinePrinter &P);
+
+ void start(const PDBSymbolTypeEnum &Symbol);
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,41 @@
+//===- PrettyExternalSymbolDumper.cpp -------------------------- *- C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyExternalSymbolDumper.h"
+#include "LinePrinter.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
+#include "llvm/Support/Format.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)
+ : PDBSymDumper(true), Printer(P) {}
+
+void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {
+ auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>();
+ while (auto Var = Vars->getNext())
+ Var->dump(*this);
+}
+
+void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {
+ std::string LinkageName = Symbol.getName();
+ if (Printer.IsSymbolExcluded(LinkageName))
+ return;
+
+ Printer.NewLine();
+ uint64_t Addr = Symbol.getVirtualAddress();
+
+ Printer << "[";
+ WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);
+ Printer << "] ";
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyExternalSymbolDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,34 @@
+//===- PrettyExternalSymbolDumper.h --------------------------- *- 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_LLVMPDBDUMP_PRETTYEXTERNALSYMBOLDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYEXTERNALSYMBOLDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+class ExternalSymbolDumper : public PDBSymDumper {
+public:
+ ExternalSymbolDumper(LinePrinter &P);
+
+ void start(const PDBSymbolExe &Symbol);
+
+ void dump(const PDBSymbolPublicSymbol &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,257 @@
+//===- PrettyFunctionDumper.cpp --------------------------------- *- C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyFunctionDumper.h"
+#include "LinePrinter.h"
+#include "PrettyBuiltinDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+#include "llvm/Support/Format.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+namespace {
+template <class T>
+void dumpClassParentWithScopeOperator(const T &Symbol, LinePrinter &Printer,
+ FunctionDumper &Dumper) {
+ uint32_t ClassParentId = Symbol.getClassParentId();
+ auto ClassParent =
+ Symbol.getSession().template getConcreteSymbolById<PDBSymbolTypeUDT>(
+ ClassParentId);
+ if (!ClassParent)
+ return;
+
+ WithColor(Printer, PDB_ColorItem::Type).get() << ClassParent->getName();
+ Printer << "::";
+}
+}
+
+FunctionDumper::FunctionDumper(LinePrinter &P)
+ : PDBSymDumper(true), Printer(P) {}
+
+void FunctionDumper::start(const PDBSymbolTypeFunctionSig &Symbol,
+ const char *Name, PointerType Pointer) {
+ auto ReturnType = Symbol.getReturnType();
+ ReturnType->dump(*this);
+ Printer << " ";
+ uint32_t ClassParentId = Symbol.getClassParentId();
+ auto ClassParent =
+ Symbol.getSession().getConcreteSymbolById<PDBSymbolTypeUDT>(
+ ClassParentId);
+
+ PDB_CallingConv CC = Symbol.getCallingConvention();
+ bool ShouldDumpCallingConvention = true;
+ if ((ClassParent && CC == CallingConvention::ThisCall) ||
+ (!ClassParent && CC == CallingConvention::NearStdCall)) {
+ ShouldDumpCallingConvention = false;
+ }
+
+ if (Pointer == PointerType::None) {
+ if (ShouldDumpCallingConvention)
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " ";
+ if (ClassParent) {
+ Printer << "(";
+ WithColor(Printer, PDB_ColorItem::Identifier).get()
+ << ClassParent->getName();
+ Printer << "::)";
+ }
+ } else {
+ Printer << "(";
+ if (ShouldDumpCallingConvention)
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << CC << " ";
+ if (ClassParent) {
+ WithColor(Printer, PDB_ColorItem::Identifier).get()
+ << ClassParent->getName();
+ Printer << "::";
+ }
+ if (Pointer == PointerType::Reference)
+ Printer << "&";
+ else
+ Printer << "*";
+ if (Name)
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Name;
+ Printer << ")";
+ }
+
+ Printer << "(";
+ if (auto ChildEnum = Symbol.getArguments()) {
+ uint32_t Index = 0;
+ while (auto Arg = ChildEnum->getNext()) {
+ Arg->dump(*this);
+ if (++Index < ChildEnum->getChildCount())
+ Printer << ", ";
+ }
+ }
+ Printer << ")";
+
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " const";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
+}
+
+void FunctionDumper::start(const PDBSymbolFunc &Symbol, PointerType Pointer) {
+ uint64_t FuncStart = Symbol.getVirtualAddress();
+ uint64_t FuncEnd = FuncStart + Symbol.getLength();
+
+ Printer << "func [";
+ WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncStart, 10);
+ if (auto DebugStart = Symbol.findOneChild<PDBSymbolFuncDebugStart>()) {
+ uint64_t Prologue = DebugStart->getVirtualAddress() - FuncStart;
+ WithColor(Printer, PDB_ColorItem::Offset).get() << "+" << Prologue;
+ }
+ Printer << " - ";
+ WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(FuncEnd, 10);
+ if (auto DebugEnd = Symbol.findOneChild<PDBSymbolFuncDebugEnd>()) {
+ uint64_t Epilogue = FuncEnd - DebugEnd->getVirtualAddress();
+ WithColor(Printer, PDB_ColorItem::Offset).get() << "-" << Epilogue;
+ }
+ Printer << "] (";
+
+ if (Symbol.hasFramePointer()) {
+ WithColor(Printer, PDB_ColorItem::Register).get()
+ << Symbol.getLocalBasePointerRegisterId();
+ } else {
+ WithColor(Printer, PDB_ColorItem::Register).get() << "FPO";
+ }
+ Printer << ") ";
+
+ if (Symbol.isVirtual() || Symbol.isPureVirtual())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "virtual ";
+
+ auto Signature = Symbol.getSignature();
+ if (!Signature) {
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+ if (Pointer == PointerType::Pointer)
+ Printer << "*";
+ else if (Pointer == FunctionDumper::PointerType::Reference)
+ Printer << "&";
+ return;
+ }
+
+ auto ReturnType = Signature->getReturnType();
+ ReturnType->dump(*this);
+ Printer << " ";
+
+ auto ClassParent = Symbol.getClassParent();
+ CallingConvention CC = Signature->getCallingConvention();
+ if (Pointer != FunctionDumper::PointerType::None)
+ Printer << "(";
+
+ if ((ClassParent && CC != CallingConvention::ThisCall) ||
+ (!ClassParent && CC != CallingConvention::NearStdCall)) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get()
+ << Signature->getCallingConvention() << " ";
+ }
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+ if (Pointer != FunctionDumper::PointerType::None) {
+ if (Pointer == PointerType::Pointer)
+ Printer << "*";
+ else if (Pointer == FunctionDumper::PointerType::Reference)
+ Printer << "&";
+ Printer << ")";
+ }
+
+ Printer << "(";
+ if (auto Arguments = Symbol.getArguments()) {
+ uint32_t Index = 0;
+ while (auto Arg = Arguments->getNext()) {
+ auto ArgType = Arg->getType();
+ ArgType->dump(*this);
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << " "
+ << Arg->getName();
+ if (++Index < Arguments->getChildCount())
+ Printer << ", ";
+ }
+ }
+ Printer << ")";
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " const";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << " volatile";
+ if (Symbol.isPureVirtual())
+ Printer << " = 0";
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeArray &Symbol) {
+ uint32_t ElementTypeId = Symbol.getTypeId();
+ auto ElementType = Symbol.getSession().getSymbolById(ElementTypeId);
+ if (!ElementType)
+ return;
+
+ ElementType->dump(*this);
+ Printer << "[";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Symbol.getLength();
+ Printer << "]";
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
+ BuiltinDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
+ dumpClassParentWithScopeOperator(Symbol, Printer, *this);
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeFunctionArg &Symbol) {
+ // PDBSymbolTypeFunctionArg is just a shim over the real argument. Just drill
+ // through to the real thing and dump it.
+ uint32_t TypeId = Symbol.getTypeId();
+ auto Type = Symbol.getSession().getSymbolById(TypeId);
+ if (!Type)
+ return;
+ Type->dump(*this);
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
+ dumpClassParentWithScopeOperator(Symbol, Printer, *this);
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
+
+void FunctionDumper::dump(const PDBSymbolTypePointer &Symbol) {
+ uint32_t PointeeId = Symbol.getTypeId();
+ auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
+ if (!PointeeType)
+ return;
+
+ if (auto FuncSig = dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
+ FunctionDumper NestedDumper(Printer);
+ PointerType Pointer =
+ Symbol.isReference() ? PointerType::Reference : PointerType::Pointer;
+ NestedDumper.start(*FuncSig, nullptr, Pointer);
+ } else {
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ PointeeType->dump(*this);
+ Printer << (Symbol.isReference() ? "&" : "*");
+ }
+}
+
+void FunctionDumper::dump(const PDBSymbolTypeUDT &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyFunctionDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,43 @@
+//===- PrettyFunctionDumper.h --------------------------------- *- 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_LLVMPDBDUMP_PRETTYFUNCTIONDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYFUNCTIONDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+class LinePrinter;
+
+class FunctionDumper : public PDBSymDumper {
+public:
+ FunctionDumper(LinePrinter &P);
+
+ enum class PointerType { None, Pointer, Reference };
+
+ void start(const PDBSymbolTypeFunctionSig &Symbol, const char *Name,
+ PointerType Pointer);
+ void start(const PDBSymbolFunc &Symbol, PointerType Pointer);
+
+ void dump(const PDBSymbolTypeArray &Symbol) override;
+ void dump(const PDBSymbolTypeBuiltin &Symbol) override;
+ void dump(const PDBSymbolTypeEnum &Symbol) override;
+ void dump(const PDBSymbolTypeFunctionArg &Symbol) override;
+ void dump(const PDBSymbolTypePointer &Symbol) override;
+ void dump(const PDBSymbolTypeTypedef &Symbol) override;
+ void dump(const PDBSymbolTypeUDT &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,98 @@
+//===- PrettyTypeDumper.cpp - PDBSymDumper type dumper *------------ C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyTypeDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyBuiltinDumper.h"
+#include "PrettyClassDefinitionDumper.h"
+#include "PrettyEnumDumper.h"
+#include "PrettyTypedefDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
+
+void TypeDumper::start(const PDBSymbolExe &Exe) {
+ auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
+ Printer << ": (" << Enums->getChildCount() << " items)";
+ Printer.Indent();
+ while (auto Enum = Enums->getNext())
+ Enum->dump(*this);
+ Printer.Unindent();
+
+ auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
+ Printer << ": (" << Typedefs->getChildCount() << " items)";
+ Printer.Indent();
+ while (auto Typedef = Typedefs->getNext())
+ Typedef->dump(*this);
+ Printer.Unindent();
+
+ auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes";
+ Printer << ": (" << Classes->getChildCount() << " items)";
+ Printer.Indent();
+ while (auto Class = Classes->getNext())
+ Class->dump(*this);
+ Printer.Unindent();
+}
+
+void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
+ if (Symbol.getUnmodifiedTypeId() != 0)
+ return;
+ if (Printer.IsTypeExcluded(Symbol.getName()))
+ return;
+ // Dump member enums when dumping their class definition.
+ if (nullptr != Symbol.getClassParent())
+ return;
+
+ Printer.NewLine();
+ EnumDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
+ if (Printer.IsTypeExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+ TypedefDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
+ if (Symbol.getUnmodifiedTypeId() != 0)
+ return;
+ if (Printer.IsTypeExcluded(Symbol.getName()))
+ return;
+
+ Printer.NewLine();
+
+ if (opts::pretty::NoClassDefs) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+ } else {
+ ClassDefinitionDumper Dumper(Printer);
+ Dumper.start(Symbol);
+ }
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyTypeDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,34 @@
+//===- PrettyTypeDumper.h - PDBSymDumper implementation for types *- 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_LLVMPDBDUMP_PRETTYTYPEDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYTYPEDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+class LinePrinter;
+
+class TypeDumper : public PDBSymDumper {
+public:
+ TypeDumper(LinePrinter &P);
+
+ void start(const PDBSymbolExe &Exe);
+
+ void dump(const PDBSymbolTypeEnum &Symbol) override;
+ void dump(const PDBSymbolTypeTypedef &Symbol) override;
+ void dump(const PDBSymbolTypeUDT &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,80 @@
+//===- PrettyTypedefDumper.cpp - PDBSymDumper impl for typedefs -- * C++ *-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyTypedefDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyBuiltinDumper.h"
+#include "PrettyFunctionDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
+#include "llvm/DebugInfo/PDB/PDBExtras.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+TypedefDumper::TypedefDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
+
+void TypedefDumper::start(const PDBSymbolTypeTypedef &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "typedef ";
+ uint32_t TargetId = Symbol.getTypeId();
+ if (auto TypeSymbol = Symbol.getSession().getSymbolById(TargetId))
+ TypeSymbol->dump(*this);
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << " "
+ << Symbol.getName();
+}
+
+void TypedefDumper::dump(const PDBSymbolTypeArray &Symbol) {}
+
+void TypedefDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
+ BuiltinDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void TypedefDumper::dump(const PDBSymbolTypeEnum &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << " " << Symbol.getName();
+}
+
+void TypedefDumper::dump(const PDBSymbolTypePointer &Symbol) {
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ uint32_t PointeeId = Symbol.getTypeId();
+ auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
+ if (!PointeeType)
+ return;
+ if (auto FuncSig = dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
+ FunctionDumper::PointerType Pointer = FunctionDumper::PointerType::Pointer;
+ if (Symbol.isReference())
+ Pointer = FunctionDumper::PointerType::Reference;
+ FunctionDumper NestedDumper(Printer);
+ NestedDumper.start(*FuncSig, nullptr, Pointer);
+ } else {
+ PointeeType->dump(*this);
+ Printer << ((Symbol.isReference()) ? "&" : "*");
+ }
+}
+
+void TypedefDumper::dump(const PDBSymbolTypeFunctionSig &Symbol) {
+ FunctionDumper Dumper(Printer);
+ Dumper.start(Symbol, nullptr, FunctionDumper::PointerType::None);
+}
+
+void TypedefDumper::dump(const PDBSymbolTypeUDT &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyTypedefDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,39 @@
+//===- PrettyTypedefDumper.h - llvm-pdbdump typedef dumper ---*- 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_LLVMPDBDUMP_PRETTYTYPEDEFDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYTYPEDEFDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+namespace pdb {
+
+class LinePrinter;
+
+class TypedefDumper : public PDBSymDumper {
+public:
+ TypedefDumper(LinePrinter &P);
+
+ void start(const PDBSymbolTypeTypedef &Symbol);
+
+ void dump(const PDBSymbolTypeArray &Symbol) override;
+ void dump(const PDBSymbolTypeBuiltin &Symbol) override;
+ void dump(const PDBSymbolTypeEnum &Symbol) override;
+ void dump(const PDBSymbolTypeFunctionSig &Symbol) override;
+ void dump(const PDBSymbolTypePointer &Symbol) override;
+ void dump(const PDBSymbolTypeUDT &Symbol) override;
+
+private:
+ LinePrinter &Printer;
+};
+}
+}
+
+#endif
Added: llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.cpp?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.cpp (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.cpp Tue Jan 10 18:35:43 2017
@@ -0,0 +1,171 @@
+//===- PrettyVariableDumper.cpp ---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PrettyVariableDumper.h"
+
+#include "LinePrinter.h"
+#include "PrettyBuiltinDumper.h"
+#include "PrettyFunctionDumper.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
+
+#include "llvm/Support/Format.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+VariableDumper::VariableDumper(LinePrinter &P)
+ : PDBSymDumper(true), Printer(P) {}
+
+void VariableDumper::start(const PDBSymbolData &Var) {
+ if (Var.isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
+ return;
+ if (Printer.IsSymbolExcluded(Var.getName()))
+ return;
+
+ auto VarType = Var.getType();
+
+ switch (auto LocType = Var.getLocationType()) {
+ case PDB_LocType::Static:
+ Printer.NewLine();
+ Printer << "data [";
+ WithColor(Printer, PDB_ColorItem::Address).get()
+ << format_hex(Var.getVirtualAddress(), 10);
+ Printer << "] ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "static ";
+ dumpSymbolTypeAndName(*VarType, Var.getName());
+ break;
+ case PDB_LocType::Constant:
+ if (isa<PDBSymbolTypeEnum>(*VarType))
+ break;
+ Printer.NewLine();
+ Printer << "data ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ dumpSymbolTypeAndName(*VarType, Var.getName());
+ Printer << " = ";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getValue();
+ break;
+ case PDB_LocType::ThisRel:
+ Printer.NewLine();
+ Printer << "data ";
+ WithColor(Printer, PDB_ColorItem::Offset).get()
+ << "+" << format_hex(Var.getOffset(), 4) << " ";
+ dumpSymbolTypeAndName(*VarType, Var.getName());
+ break;
+ case PDB_LocType::BitField:
+ Printer.NewLine();
+ Printer << "data ";
+ WithColor(Printer, PDB_ColorItem::Offset).get()
+ << "+" << format_hex(Var.getOffset(), 4) << " ";
+ dumpSymbolTypeAndName(*VarType, Var.getName());
+ Printer << " : ";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getLength();
+ break;
+ default:
+ Printer.NewLine();
+ Printer << "data ";
+ Printer << "unknown(" << LocType << ") ";
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << Var.getName();
+ break;
+ }
+}
+
+void VariableDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
+ BuiltinDumper Dumper(Printer);
+ Dumper.start(Symbol);
+}
+
+void VariableDumper::dump(const PDBSymbolTypeEnum &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
+
+void VariableDumper::dump(const PDBSymbolTypeFunctionSig &Symbol) {}
+
+void VariableDumper::dump(const PDBSymbolTypePointer &Symbol) {
+ auto PointeeType = Symbol.getPointeeType();
+ if (!PointeeType)
+ return;
+
+ if (auto Func = dyn_cast<PDBSymbolFunc>(PointeeType.get())) {
+ FunctionDumper NestedDumper(Printer);
+ FunctionDumper::PointerType Pointer =
+ Symbol.isReference() ? FunctionDumper::PointerType::Reference
+ : FunctionDumper::PointerType::Pointer;
+ NestedDumper.start(*Func, Pointer);
+ } else {
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ PointeeType->dump(*this);
+ Printer << (Symbol.isReference() ? "&" : "*");
+ }
+}
+
+void VariableDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "typedef ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
+
+void VariableDumper::dump(const PDBSymbolTypeUDT &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+}
+
+void VariableDumper::dumpSymbolTypeAndName(const PDBSymbol &Type,
+ StringRef Name) {
+ if (auto *ArrayType = dyn_cast<PDBSymbolTypeArray>(&Type)) {
+ std::string IndexSpec;
+ raw_string_ostream IndexStream(IndexSpec);
+ std::unique_ptr<PDBSymbol> ElementType = ArrayType->getElementType();
+ while (auto NestedArray = dyn_cast<PDBSymbolTypeArray>(ElementType.get())) {
+ IndexStream << "[";
+ IndexStream << NestedArray->getCount();
+ IndexStream << "]";
+ ElementType = NestedArray->getElementType();
+ }
+ IndexStream << "[" << ArrayType->getCount() << "]";
+ ElementType->dump(*this);
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << " " << Name;
+ Printer << IndexStream.str();
+ } else {
+ if (!tryDumpFunctionPointer(Type, Name)) {
+ Type.dump(*this);
+ WithColor(Printer, PDB_ColorItem::Identifier).get() << " " << Name;
+ }
+ }
+}
+
+bool VariableDumper::tryDumpFunctionPointer(const PDBSymbol &Type,
+ StringRef Name) {
+ // Function pointers come across as pointers to function signatures. But the
+ // signature carries no name, so we have to handle this case separately.
+ if (auto *PointerType = dyn_cast<PDBSymbolTypePointer>(&Type)) {
+ auto PointeeType = PointerType->getPointeeType();
+ if (auto *FunctionSig =
+ dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
+ FunctionDumper Dumper(Printer);
+ FunctionDumper::PointerType PT = FunctionDumper::PointerType::Pointer;
+ if (PointerType->isReference())
+ PT = FunctionDumper::PointerType::Reference;
+ std::string NameStr(Name.begin(), Name.end());
+ Dumper.start(*FunctionSig, NameStr.c_str(), PT);
+ return true;
+ }
+ }
+ return false;
+}
Added: llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.h?rev=291627&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.h (added)
+++ llvm/trunk/tools/llvm-pdbdump/PrettyVariableDumper.h Tue Jan 10 18:35:43 2017
@@ -0,0 +1,44 @@
+//===- PrettyVariableDumper.h - PDBSymDumper variable dumper ----*- 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_LLVMPDBDUMP_PRETTYVARIABLEDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_PRETTYVARIABLEDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+
+class StringRef;
+
+namespace pdb {
+
+class LinePrinter;
+
+class VariableDumper : public PDBSymDumper {
+public:
+ VariableDumper(LinePrinter &P);
+
+ void start(const PDBSymbolData &Var);
+
+ void dump(const PDBSymbolTypeBuiltin &Symbol) override;
+ void dump(const PDBSymbolTypeEnum &Symbol) override;
+ void dump(const PDBSymbolTypeFunctionSig &Symbol) override;
+ void dump(const PDBSymbolTypePointer &Symbol) override;
+ void dump(const PDBSymbolTypeTypedef &Symbol) override;
+ void dump(const PDBSymbolTypeUDT &Symbol) override;
+
+private:
+ void dumpSymbolTypeAndName(const PDBSymbol &Type, StringRef Name);
+ bool tryDumpFunctionPointer(const PDBSymbol &Type, StringRef Name);
+
+ LinePrinter &Printer;
+};
+}
+}
+#endif
Removed: llvm/trunk/tools/llvm-pdbdump/TypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/TypeDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/TypeDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/TypeDumper.cpp (removed)
@@ -1,98 +0,0 @@
-//===- TypeDumper.cpp - PDBSymDumper implementation for types *----- C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "TypeDumper.h"
-
-#include "BuiltinDumper.h"
-#include "ClassDefinitionDumper.h"
-#include "EnumDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-#include "TypedefDumper.h"
-
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
-
-void TypeDumper::start(const PDBSymbolExe &Exe) {
- auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
- Printer << ": (" << Enums->getChildCount() << " items)";
- Printer.Indent();
- while (auto Enum = Enums->getNext())
- Enum->dump(*this);
- Printer.Unindent();
-
- auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
- Printer << ": (" << Typedefs->getChildCount() << " items)";
- Printer.Indent();
- while (auto Typedef = Typedefs->getNext())
- Typedef->dump(*this);
- Printer.Unindent();
-
- auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes";
- Printer << ": (" << Classes->getChildCount() << " items)";
- Printer.Indent();
- while (auto Class = Classes->getNext())
- Class->dump(*this);
- Printer.Unindent();
-}
-
-void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
- if (Symbol.getUnmodifiedTypeId() != 0)
- return;
- if (Printer.IsTypeExcluded(Symbol.getName()))
- return;
- // Dump member enums when dumping their class definition.
- if (nullptr != Symbol.getClassParent())
- return;
-
- Printer.NewLine();
- EnumDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
- if (Printer.IsTypeExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
- TypedefDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
- if (Symbol.getUnmodifiedTypeId() != 0)
- return;
- if (Printer.IsTypeExcluded(Symbol.getName()))
- return;
-
- Printer.NewLine();
-
- if (opts::pretty::NoClassDefs) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
- } else {
- ClassDefinitionDumper Dumper(Printer);
- Dumper.start(Symbol);
- }
-}
Removed: llvm/trunk/tools/llvm-pdbdump/TypeDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/TypeDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/TypeDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/TypeDumper.h (removed)
@@ -1,34 +0,0 @@
-//===- TypeDumper.h - PDBSymDumper implementation for types *- 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_LLVMPDBDUMP_TYPEDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_TYPEDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-class LinePrinter;
-
-class TypeDumper : public PDBSymDumper {
-public:
- TypeDumper(LinePrinter &P);
-
- void start(const PDBSymbolExe &Exe);
-
- void dump(const PDBSymbolTypeEnum &Symbol) override;
- void dump(const PDBSymbolTypeTypedef &Symbol) override;
- void dump(const PDBSymbolTypeUDT &Symbol) override;
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/TypedefDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/TypedefDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/TypedefDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/TypedefDumper.cpp (removed)
@@ -1,80 +0,0 @@
-//===- TypedefDumper.cpp - PDBSymDumper impl for typedefs -------- * C++ *-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "TypedefDumper.h"
-
-#include "BuiltinDumper.h"
-#include "FunctionDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBExtras.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-TypedefDumper::TypedefDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
-
-void TypedefDumper::start(const PDBSymbolTypeTypedef &Symbol) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "typedef ";
- uint32_t TargetId = Symbol.getTypeId();
- if (auto TypeSymbol = Symbol.getSession().getSymbolById(TargetId))
- TypeSymbol->dump(*this);
- WithColor(Printer, PDB_ColorItem::Identifier).get() << " "
- << Symbol.getName();
-}
-
-void TypedefDumper::dump(const PDBSymbolTypeArray &Symbol) {}
-
-void TypedefDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
- BuiltinDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void TypedefDumper::dump(const PDBSymbolTypeEnum &Symbol) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
- WithColor(Printer, PDB_ColorItem::Type).get() << " " << Symbol.getName();
-}
-
-void TypedefDumper::dump(const PDBSymbolTypePointer &Symbol) {
- if (Symbol.isConstType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
- if (Symbol.isVolatileType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
- uint32_t PointeeId = Symbol.getTypeId();
- auto PointeeType = Symbol.getSession().getSymbolById(PointeeId);
- if (!PointeeType)
- return;
- if (auto FuncSig = dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
- FunctionDumper::PointerType Pointer = FunctionDumper::PointerType::Pointer;
- if (Symbol.isReference())
- Pointer = FunctionDumper::PointerType::Reference;
- FunctionDumper NestedDumper(Printer);
- NestedDumper.start(*FuncSig, nullptr, Pointer);
- } else {
- PointeeType->dump(*this);
- Printer << ((Symbol.isReference()) ? "&" : "*");
- }
-}
-
-void TypedefDumper::dump(const PDBSymbolTypeFunctionSig &Symbol) {
- FunctionDumper Dumper(Printer);
- Dumper.start(Symbol, nullptr, FunctionDumper::PointerType::None);
-}
-
-void TypedefDumper::dump(const PDBSymbolTypeUDT &Symbol) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
Removed: llvm/trunk/tools/llvm-pdbdump/TypedefDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/TypedefDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/TypedefDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/TypedefDumper.h (removed)
@@ -1,39 +0,0 @@
-//===- TypedefDumper.h - llvm-pdbdump typedef dumper ---------*- 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_LLVMPDBDUMP_TYPEDEFDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_TYPEDEFDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-namespace pdb {
-
-class LinePrinter;
-
-class TypedefDumper : public PDBSymDumper {
-public:
- TypedefDumper(LinePrinter &P);
-
- void start(const PDBSymbolTypeTypedef &Symbol);
-
- void dump(const PDBSymbolTypeArray &Symbol) override;
- void dump(const PDBSymbolTypeBuiltin &Symbol) override;
- void dump(const PDBSymbolTypeEnum &Symbol) override;
- void dump(const PDBSymbolTypeFunctionSig &Symbol) override;
- void dump(const PDBSymbolTypePointer &Symbol) override;
- void dump(const PDBSymbolTypeUDT &Symbol) override;
-
-private:
- LinePrinter &Printer;
-};
-}
-}
-
-#endif
Removed: llvm/trunk/tools/llvm-pdbdump/VariableDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/VariableDumper.cpp?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/VariableDumper.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/VariableDumper.cpp (removed)
@@ -1,171 +0,0 @@
-//===- VariableDumper.cpp - -------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "VariableDumper.h"
-
-#include "BuiltinDumper.h"
-#include "LinePrinter.h"
-#include "llvm-pdbdump.h"
-#include "FunctionDumper.h"
-
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-
-#include "llvm/Support/Format.h"
-
-using namespace llvm;
-using namespace llvm::pdb;
-
-VariableDumper::VariableDumper(LinePrinter &P)
- : PDBSymDumper(true), Printer(P) {}
-
-void VariableDumper::start(const PDBSymbolData &Var) {
- if (Var.isCompilerGenerated() && opts::pretty::ExcludeCompilerGenerated)
- return;
- if (Printer.IsSymbolExcluded(Var.getName()))
- return;
-
- auto VarType = Var.getType();
-
- switch (auto LocType = Var.getLocationType()) {
- case PDB_LocType::Static:
- Printer.NewLine();
- Printer << "data [";
- WithColor(Printer, PDB_ColorItem::Address).get()
- << format_hex(Var.getVirtualAddress(), 10);
- Printer << "] ";
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "static ";
- dumpSymbolTypeAndName(*VarType, Var.getName());
- break;
- case PDB_LocType::Constant:
- if (isa<PDBSymbolTypeEnum>(*VarType))
- break;
- Printer.NewLine();
- Printer << "data ";
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
- dumpSymbolTypeAndName(*VarType, Var.getName());
- Printer << " = ";
- WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getValue();
- break;
- case PDB_LocType::ThisRel:
- Printer.NewLine();
- Printer << "data ";
- WithColor(Printer, PDB_ColorItem::Offset).get()
- << "+" << format_hex(Var.getOffset(), 4) << " ";
- dumpSymbolTypeAndName(*VarType, Var.getName());
- break;
- case PDB_LocType::BitField:
- Printer.NewLine();
- Printer << "data ";
- WithColor(Printer, PDB_ColorItem::Offset).get()
- << "+" << format_hex(Var.getOffset(), 4) << " ";
- dumpSymbolTypeAndName(*VarType, Var.getName());
- Printer << " : ";
- WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getLength();
- break;
- default:
- Printer.NewLine();
- Printer << "data ";
- Printer << "unknown(" << LocType << ") ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Var.getName();
- break;
- }
-}
-
-void VariableDumper::dump(const PDBSymbolTypeBuiltin &Symbol) {
- BuiltinDumper Dumper(Printer);
- Dumper.start(Symbol);
-}
-
-void VariableDumper::dump(const PDBSymbolTypeEnum &Symbol) {
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
-
-void VariableDumper::dump(const PDBSymbolTypeFunctionSig &Symbol) {}
-
-void VariableDumper::dump(const PDBSymbolTypePointer &Symbol) {
- auto PointeeType = Symbol.getPointeeType();
- if (!PointeeType)
- return;
-
- if (auto Func = dyn_cast<PDBSymbolFunc>(PointeeType.get())) {
- FunctionDumper NestedDumper(Printer);
- FunctionDumper::PointerType Pointer =
- Symbol.isReference() ? FunctionDumper::PointerType::Reference
- : FunctionDumper::PointerType::Pointer;
- NestedDumper.start(*Func, Pointer);
- } else {
- if (Symbol.isConstType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
- if (Symbol.isVolatileType())
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
- PointeeType->dump(*this);
- Printer << (Symbol.isReference() ? "&" : "*");
- }
-}
-
-void VariableDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "typedef ";
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
-
-void VariableDumper::dump(const PDBSymbolTypeUDT &Symbol) {
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
-}
-
-void VariableDumper::dumpSymbolTypeAndName(const PDBSymbol &Type,
- StringRef Name) {
- if (auto *ArrayType = dyn_cast<PDBSymbolTypeArray>(&Type)) {
- std::string IndexSpec;
- raw_string_ostream IndexStream(IndexSpec);
- std::unique_ptr<PDBSymbol> ElementType = ArrayType->getElementType();
- while (auto NestedArray = dyn_cast<PDBSymbolTypeArray>(ElementType.get())) {
- IndexStream << "[";
- IndexStream << NestedArray->getCount();
- IndexStream << "]";
- ElementType = NestedArray->getElementType();
- }
- IndexStream << "[" << ArrayType->getCount() << "]";
- ElementType->dump(*this);
- WithColor(Printer, PDB_ColorItem::Identifier).get() << " " << Name;
- Printer << IndexStream.str();
- } else {
- if (!tryDumpFunctionPointer(Type, Name)) {
- Type.dump(*this);
- WithColor(Printer, PDB_ColorItem::Identifier).get() << " " << Name;
- }
- }
-}
-
-bool VariableDumper::tryDumpFunctionPointer(const PDBSymbol &Type,
- StringRef Name) {
- // Function pointers come across as pointers to function signatures. But the
- // signature carries no name, so we have to handle this case separately.
- if (auto *PointerType = dyn_cast<PDBSymbolTypePointer>(&Type)) {
- auto PointeeType = PointerType->getPointeeType();
- if (auto *FunctionSig =
- dyn_cast<PDBSymbolTypeFunctionSig>(PointeeType.get())) {
- FunctionDumper Dumper(Printer);
- FunctionDumper::PointerType PT = FunctionDumper::PointerType::Pointer;
- if (PointerType->isReference())
- PT = FunctionDumper::PointerType::Reference;
- std::string NameStr(Name.begin(), Name.end());
- Dumper.start(*FunctionSig, NameStr.c_str(), PT);
- return true;
- }
- }
- return false;
-}
Removed: llvm/trunk/tools/llvm-pdbdump/VariableDumper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/VariableDumper.h?rev=291626&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/VariableDumper.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/VariableDumper.h (removed)
@@ -1,44 +0,0 @@
-//===- VariableDumper.h - PDBSymDumper implementation for types -*- 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_LLVMPDBDUMP_VARIABLEDUMPER_H
-#define LLVM_TOOLS_LLVMPDBDUMP_VARIABLEDUMPER_H
-
-#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
-
-namespace llvm {
-
-class StringRef;
-
-namespace pdb {
-
-class LinePrinter;
-
-class VariableDumper : public PDBSymDumper {
-public:
- VariableDumper(LinePrinter &P);
-
- void start(const PDBSymbolData &Var);
-
- void dump(const PDBSymbolTypeBuiltin &Symbol) override;
- void dump(const PDBSymbolTypeEnum &Symbol) override;
- void dump(const PDBSymbolTypeFunctionSig &Symbol) override;
- void dump(const PDBSymbolTypePointer &Symbol) override;
- void dump(const PDBSymbolTypeTypedef &Symbol) override;
- void dump(const PDBSymbolTypeUDT &Symbol) override;
-
-private:
- void dumpSymbolTypeAndName(const PDBSymbol &Type, StringRef Name);
- bool tryDumpFunctionPointer(const PDBSymbol &Type, StringRef Name);
-
- LinePrinter &Printer;
-};
-}
-}
-#endif
Modified: llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h (original)
+++ llvm/trunk/tools/llvm-pdbdump/YAMLOutputStyle.h Tue Jan 10 18:35:43 2017
@@ -13,7 +13,7 @@
#include "OutputStyle.h"
#include "PdbYaml.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/Support/ScopedPrinter.h"
#include "llvm/Support/YAMLTraits.h"
Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Tue Jan 10 18:35:43 2017
@@ -14,14 +14,14 @@
//===----------------------------------------------------------------------===//
#include "llvm-pdbdump.h"
-#include "CompilandDumper.h"
-#include "ExternalSymbolDumper.h"
-#include "FunctionDumper.h"
#include "LLVMOutputStyle.h"
#include "LinePrinter.h"
#include "OutputStyle.h"
-#include "TypeDumper.h"
-#include "VariableDumper.h"
+#include "PrettyCompilandDumper.h"
+#include "PrettyExternalSymbolDumper.h"
+#include "PrettyFunctionDumper.h"
+#include "PrettyTypeDumper.h"
+#include "PrettyVariableDumper.h"
#include "YAMLOutputStyle.h"
#include "llvm/ADT/ArrayRef.h"
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=291627&r1=291626&r2=291627&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Tue Jan 10 18:35:43 2017
@@ -22,6 +22,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
@@ -29,7 +30,6 @@
#include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeDumper.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
More information about the llvm-commits
mailing list