llvm.org GIT mirror llvm / 926749a
DebugInfoPDB: Make the symbol base case hold an IPDBSession ref. Dumping a symbol often requires access to data that isn't inside the symbol hierarchy, but which is only accessible through the top-level session. This patch is a pure interface change to give symbols a reference to the session. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228542 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 4 years ago
65 changed file(s) with 181 addition(s) and 108 deletion(s). Raw diff Collapse all Expand all
3535 /// https://msdn.microsoft.com/en-us/library/370hs6k4.aspx
3636 class PDBSymbol {
3737 protected:
38 PDBSymbol(std::unique_ptr Symbol);
38 PDBSymbol(IPDBSession &PDBSession, std::unique_ptr Symbol);
3939
4040 public:
4141 static std::unique_ptr
42 create(std::unique_ptr Symbol);
42 create(IPDBSession &PDBSession, std::unique_ptr Symbol);
4343
4444 virtual ~PDBSymbol();
4545
6161 std::unique_ptr findInlineFramesByRVA(uint32_t RVA) const;
6262
6363 protected:
64 IPDBSession &Session;
6465 const std::unique_ptr RawSymbol;
6566 };
6667
1919
2020 class PDBSymbolAnnotation : public PDBSymbol {
2121 public:
22 PDBSymbolAnnotation(std::unique_ptr AnnotationSymbol);
22 PDBSymbolAnnotation(IPDBSession &PDBSession,
23 std::unique_ptr Symbol);
2324
2425 void dump(llvm::raw_ostream &OS) const override;
2526
1919
2020 class PDBSymbolBlock : public PDBSymbol {
2121 public:
22 PDBSymbolBlock(std::unique_ptr BlockSymbol);
22 PDBSymbolBlock(IPDBSession &PDBSession,
23 std::unique_ptr Symbol);
2324
2425 void dump(llvm::raw_ostream &OS) const override;
2526
1919
2020 class PDBSymbolCompiland : public PDBSymbol {
2121 public:
22 PDBSymbolCompiland(std::unique_ptr CompilandSymbol);
22 PDBSymbolCompiland(IPDBSession &PDBSession,
23 std::unique_ptr CompilandSymbol);
2324
2425 void dump(llvm::raw_ostream &OS) const override;
2526
1818
1919 class PDBSymbolCompilandDetails : public PDBSymbol {
2020 public:
21 PDBSymbolCompilandDetails(std::unique_ptr DetailsSymbol);
21 PDBSymbolCompilandDetails(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolCompilandEnv : public PDBSymbol {
2020 public:
21 PDBSymbolCompilandEnv(std::unique_ptr CompilandEnvSymbol);
21 PDBSymbolCompilandEnv(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
2323 /// https://msdn.microsoft.com/en-us/library/d88sf09h.aspx
2424 class PDBSymbolCustom : public PDBSymbol {
2525 public:
26 PDBSymbolCustom(std::unique_ptr CustomSymbol);
26 PDBSymbolCustom(IPDBSession &PDBSession,
27 std::unique_ptr CustomSymbol);
2728
2829 void dump(llvm::raw_ostream &OS) const override;
2930
1818
1919 class PDBSymbolData : public PDBSymbol {
2020 public:
21 PDBSymbolData(std::unique_ptr DataSymbol);
21 PDBSymbolData(IPDBSession &PDBSession,
22 std::unique_ptr DataSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
2222
2323 class PDBSymbolExe : public PDBSymbol {
2424 public:
25 PDBSymbolExe(std::unique_ptr ExeSymbol);
25 PDBSymbolExe(IPDBSession &PDBSession,
26 std::unique_ptr ExeSymbol);
2627
2728 void dump(llvm::raw_ostream &OS) const override;
2829
1818
1919 class PDBSymbolFunc : public PDBSymbol {
2020 public:
21 PDBSymbolFunc(std::unique_ptr FuncSymbol);
21 PDBSymbolFunc(IPDBSession &PDBSession,
22 std::unique_ptr FuncSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolFuncDebugEnd : public PDBSymbol {
2020 public:
21 PDBSymbolFuncDebugEnd(std::unique_ptr FuncDebugEndSymbol);
21 PDBSymbolFuncDebugEnd(IPDBSession &PDBSession,
22 std::unique_ptr FuncDebugEndSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolFuncDebugStart : public PDBSymbol {
2020 public:
21 PDBSymbolFuncDebugStart(std::unique_ptr FuncDebugStartSymbol);
21 PDBSymbolFuncDebugStart(IPDBSession &PDBSession,
22 std::unique_ptr FuncDebugStartSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolLabel : public PDBSymbol {
2020 public:
21 PDBSymbolLabel(std::unique_ptr LabelSymbol);
21 PDBSymbolLabel(IPDBSession &PDBSession,
22 std::unique_ptr LabelSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolPublicSymbol : public PDBSymbol {
2020 public:
21 PDBSymbolPublicSymbol(std::unique_ptr PublicSymbol);
21 PDBSymbolPublicSymbol(IPDBSession &PDBSession,
22 std::unique_ptr PublicSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
2020
2121 class PDBSymbolThunk : public PDBSymbol {
2222 public:
23 PDBSymbolThunk(std::unique_ptr ThunkSymbol);
23 PDBSymbolThunk(IPDBSession &PDBSession,
24 std::unique_ptr ThunkSymbol);
2425
2526 void dump(llvm::raw_ostream &OS) const override;
2627
1818
1919 class PDBSymbolTypeArray : public PDBSymbol {
2020 public:
21 PDBSymbolTypeArray(std::unique_ptr ArrayTypeSymbol);
21 PDBSymbolTypeArray(IPDBSession &PDBSession,
22 std::unique_ptr ArrayTypeSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeBaseClass : public PDBSymbol {
2020 public:
21 PDBSymbolTypeBaseClass(std::unique_ptr BaseClassTypeSymbol);
21 PDBSymbolTypeBaseClass(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeBuiltin : public PDBSymbol {
2020 public:
21 PDBSymbolTypeBuiltin(std::unique_ptr BuiltinTypeSymbol);
21 PDBSymbolTypeBuiltin(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeCustom : public PDBSymbol {
2020 public:
21 PDBSymbolTypeCustom(std::unique_ptr CustomTypeSymbol);
21 PDBSymbolTypeCustom(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeDimension : public PDBSymbol {
2020 public:
21 PDBSymbolTypeDimension(std::unique_ptr DimensionTypeSymbol);
21 PDBSymbolTypeDimension(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeEnum : public PDBSymbol {
2020 public:
21 PDBSymbolTypeEnum(std::unique_ptr EnumTypeSymbol);
21 PDBSymbolTypeEnum(IPDBSession &PDBSession,
22 std::unique_ptr EnumTypeSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeFriend : public PDBSymbol {
2020 public:
21 PDBSymbolTypeFriend(std::unique_ptr FriendTypeSymbol);
21 PDBSymbolTypeFriend(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeFunctionArg : public PDBSymbol {
2020 public:
21 PDBSymbolTypeFunctionArg(std::unique_ptr FuncArgTypeSymbol);
21 PDBSymbolTypeFunctionArg(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeFunctionSig : public PDBSymbol {
2020 public:
21 PDBSymbolTypeFunctionSig(std::unique_ptr FuncSigTypeSymbol);
21 PDBSymbolTypeFunctionSig(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeManaged : public PDBSymbol {
2020 public:
21 PDBSymbolTypeManaged(std::unique_ptr ManagedTypeSymbol);
21 PDBSymbolTypeManaged(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypePointer : public PDBSymbol {
2020 public:
21 PDBSymbolTypePointer(std::unique_ptr PointerTypeSymbol);
21 PDBSymbolTypePointer(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeTypedef : public PDBSymbol {
2020 public:
21 PDBSymbolTypeTypedef(std::unique_ptr TypedefSymbol);
21 PDBSymbolTypeTypedef(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeUDT : public PDBSymbol {
2020 public:
21 PDBSymbolTypeUDT(std::unique_ptr UDTSymbol);
21 PDBSymbolTypeUDT(IPDBSession &PDBSession,
22 std::unique_ptr UDTSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeVTable : public PDBSymbol {
2020 public:
21 PDBSymbolTypeVTable(std::unique_ptr VtblSymbol);
21 PDBSymbolTypeVTable(IPDBSession &PDBSession,
22 std::unique_ptr VtblSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolTypeVTableShape : public PDBSymbol {
2020 public:
21 PDBSymbolTypeVTableShape(std::unique_ptr VtblShapeSymbol);
21 PDBSymbolTypeVTableShape(IPDBSession &PDBSession,
22 std::unique_ptr VtblShapeSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolUnknown : public PDBSymbol {
2020 public:
21 PDBSymbolUnknown(std::unique_ptr UnknownSymbol);
21 PDBSymbolUnknown(IPDBSession &PDBSession,
22 std::unique_ptr UnknownSymbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
1818
1919 class PDBSymbolUsingNamespace : public PDBSymbol {
2020 public:
21 PDBSymbolUsingNamespace(std::unique_ptr UsingSymbol);
21 PDBSymbolUsingNamespace(IPDBSession &PDBSession,
22 std::unique_ptr Symbol);
2223
2324 void dump(llvm::raw_ostream &OS) const override;
2425
4747
4848 using namespace llvm;
4949
50 PDBSymbol::PDBSymbol(std::unique_ptr Symbol)
51 : RawSymbol(std::move(Symbol)) {}
50 PDBSymbol::PDBSymbol(IPDBSession &PDBSession,
51 std::unique_ptr Symbol)
52 : Session(PDBSession), RawSymbol(std::move(Symbol)) {}
5253
5354 PDBSymbol::~PDBSymbol() {}
5455
5556 #define FACTORY_SYMTAG_CASE(Tag, Type) \
5657 case PDB_SymType::Tag: \
57 return std::unique_ptr(new Type(std::move(Symbol)));
58 return std::unique_ptr(new Type(PDBSession, std::move(Symbol)));
5859
5960 std::unique_ptr
60 PDBSymbol::create(std::unique_ptr Symbol) {
61 PDBSymbol::create(IPDBSession &PDBSession,
62 std::unique_ptr Symbol) {
6163 switch (Symbol->getSymTag()) {
6264 FACTORY_SYMTAG_CASE(Exe, PDBSymbolExe)
6365 FACTORY_SYMTAG_CASE(Compiland, PDBSymbolCompiland)
9092 FACTORY_SYMTAG_CASE(ManagedType, PDBSymbolTypeManaged)
9193 FACTORY_SYMTAG_CASE(Dimension, PDBSymbolTypeDimension)
9294 default:
93 return std::unique_ptr(new PDBSymbolUnknown(std::move(Symbol)));
95 return std::unique_ptr(
96 new PDBSymbolUnknown(PDBSession, std::move(Symbol)));
9497 }
9598 }
9699
1313
1414 using namespace llvm;
1515
16 PDBSymbolAnnotation::PDBSymbolAnnotation(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolAnnotation::PDBSymbolAnnotation(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolAnnotation::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolBlock::PDBSymbolBlock(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolBlock::PDBSymbolBlock(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1819
1920 void PDBSymbolBlock::dump(llvm::raw_ostream &OS) const {}
1616
1717 using namespace llvm;
1818
19 PDBSymbolCompiland::PDBSymbolCompiland(std::unique_ptr Symbol)
20 : PDBSymbol(std::move(Symbol)) {}
19 PDBSymbolCompiland::PDBSymbolCompiland(IPDBSession &PDBSession,
20 std::unique_ptr Symbol)
21 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2122
2223 void PDBSymbolCompiland::dump(llvm::raw_ostream &OS) const {
2324 }
1414 using namespace llvm;
1515
1616 PDBSymbolCompilandDetails::PDBSymbolCompilandDetails(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1919
2020 void PDBSymbolCompilandDetails::dump(llvm::raw_ostream &OS) const {}
1515 using namespace llvm;
1616
1717 PDBSymbolCompilandEnv::PDBSymbolCompilandEnv(
18 std::unique_ptr Symbol)
19 : PDBSymbol(std::move(Symbol)) {}
18 IPDBSession &PDBSession, std::unique_ptr Symbol)
19 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2020
2121 std::string PDBSymbolCompilandEnv::getValue() const {
2222 // call RawSymbol->getValue() and convert the result to an std::string.
1414
1515 using namespace llvm;
1616
17 PDBSymbolCustom::PDBSymbolCustom(std::unique_ptr CustomSymbol)
18 : PDBSymbol(std::move(CustomSymbol)) {}
17 PDBSymbolCustom::PDBSymbolCustom(IPDBSession &PDBSession,
18 std::unique_ptr CustomSymbol)
19 : PDBSymbol(PDBSession, std::move(CustomSymbol)) {}
1920
2021 void PDBSymbolCustom::getDataBytes(llvm::SmallVector &bytes) {
2122 RawSymbol->getDataBytes(bytes);
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include
910 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
1011
1112 using namespace llvm;
1213
13 PDBSymbolData::PDBSymbolData(std::unique_ptr DataSymbol)
14 : PDBSymbol(std::move(DataSymbol)) {}
14 PDBSymbolData::PDBSymbolData(IPDBSession &PDBSession,
15 std::unique_ptr DataSymbol)
16 : PDBSymbol(PDBSession, std::move(DataSymbol)) {}
1517
1618 void PDBSymbolData::dump(llvm::raw_ostream &OS) const {}
1616
1717 using namespace llvm;
1818
19 PDBSymbolExe::PDBSymbolExe(std::unique_ptr Symbol)
20 : PDBSymbol(std::move(Symbol)) {}
19 PDBSymbolExe::PDBSymbolExe(IPDBSession &PDBSession,
20 std::unique_ptr Symbol)
21 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2122
2223 void PDBSymbolExe::dump(llvm::raw_ostream &OS) const {
2324 }
1313
1414 using namespace llvm;
1515
16 PDBSymbolFunc::PDBSymbolFunc(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolFunc::PDBSymbolFunc(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolFunc::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolFuncDebugEnd::PDBSymbolFuncDebugEnd(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1919
2020 void PDBSymbolFuncDebugEnd::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolFuncDebugStart::PDBSymbolFuncDebugStart(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1919
2020 void PDBSymbolFuncDebugStart::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolLabel::PDBSymbolLabel(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolLabel::PDBSymbolLabel(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1819
1920 void PDBSymbolLabel::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolPublicSymbol::PDBSymbolPublicSymbol(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1919
2020 void PDBSymbolPublicSymbol::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolThunk::PDBSymbolThunk(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolThunk::PDBSymbolThunk(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1819
1920 void PDBSymbolThunk::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeArray::PDBSymbolTypeArray(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeArray::PDBSymbolTypeArray(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeArray::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeBaseClass::PDBSymbolTypeBaseClass(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(Session, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeBaseClass::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeBuiltin::PDBSymbolTypeBuiltin(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeBuiltin::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeCustom::PDBSymbolTypeCustom(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeCustom::PDBSymbolTypeCustom(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeCustom::dump(llvm::raw_ostream &OS) const {}
1515 using namespace llvm;
1616
1717 PDBSymbolTypeDimension::PDBSymbolTypeDimension(
18 std::unique_ptr Symbol)
19 : PDBSymbol(std::move(Symbol)) {}
18 IPDBSession &PDBSession, std::unique_ptr Symbol)
19 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2020
2121 void PDBSymbolTypeDimension::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeEnum::PDBSymbolTypeEnum(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeEnum::PDBSymbolTypeEnum(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeEnum::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeFriend::PDBSymbolTypeFriend(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeFriend::PDBSymbolTypeFriend(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeFriend::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeFunctionArg::PDBSymbolTypeFunctionArg(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeFunctionArg::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeFunctionSig::PDBSymbolTypeFunctionSig(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeFunctionSig::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeManaged::PDBSymbolTypeManaged(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeManaged::dump(llvm::raw_ostream &OS) const {}
1515 using namespace llvm;
1616
1717 PDBSymbolTypePointer::PDBSymbolTypePointer(
18 std::unique_ptr Symbol)
19 : PDBSymbol(std::move(Symbol)) {}
18 IPDBSession &PDBSession, std::unique_ptr Symbol)
19 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2020
2121 void PDBSymbolTypePointer::dump(llvm::raw_ostream &OS) const {}
1515 using namespace llvm;
1616
1717 PDBSymbolTypeTypedef::PDBSymbolTypeTypedef(
18 std::unique_ptr Symbol)
19 : PDBSymbol(std::move(Symbol)) {}
18 IPDBSession &PDBSession, std::unique_ptr Symbol)
19 : PDBSymbol(PDBSession, std::move(Symbol)) {}
2020
2121 void PDBSymbolTypeTypedef::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeUDT::PDBSymbolTypeUDT(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeUDT::PDBSymbolTypeUDT(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeUDT::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolTypeVTable::PDBSymbolTypeVTable(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolTypeVTable::PDBSymbolTypeVTable(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolTypeVTable::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolTypeVTableShape::PDBSymbolTypeVTableShape(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolTypeVTableShape::dump(llvm::raw_ostream &OS) const {}
1313
1414 using namespace llvm;
1515
16 PDBSymbolUnknown::PDBSymbolUnknown(std::unique_ptr Symbol)
17 : PDBSymbol(std::move(Symbol)) {}
16 PDBSymbolUnknown::PDBSymbolUnknown(IPDBSession &PDBSession,
17 std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1819
1920 void PDBSymbolUnknown::dump(llvm::raw_ostream &OS) const {}
1414 using namespace llvm;
1515
1616 PDBSymbolUsingNamespace::PDBSymbolUsingNamespace(
17 std::unique_ptr Symbol)
18 : PDBSymbol(std::move(Symbol)) {}
17 IPDBSession &PDBSession, std::unique_ptr Symbol)
18 : PDBSymbol(PDBSession, std::move(Symbol)) {}
1919
2020 void PDBSymbolUsingNamespace::dump(llvm::raw_ostream &OS) const {}
1111
1212 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
1313 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
14 #include "llvm/DebugInfo/PDB/IPDBSession.h"
15 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
16
1417 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
1518 #include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h"
1619 #include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
6467 typedef decltype(IPDBRawSymbol::Func()) ReturnType; \
6568 return ReturnType(); \
6669 }
70
71 class MockSession : public IPDBSession {
72 uint64_t getLoadAddress() const override { return 0; }
73 void setLoadAddress(uint64_t Address) override {}
74 std::unique_ptr getGlobalScope() const override {
75 return nullptr;
76 }
77 std::unique_ptr getSymbolById() const override { return nullptr; }
78 std::unique_ptr getSourceFileById() const override {
79 return nullptr;
80 }
81 std::unique_ptr getDebugStreams() const override {
82 return nullptr;
83 }
84 };
6785
6886 class MockRawSymbol : public IPDBRawSymbol {
6987 public:
256274 std::unordered_map> SymbolMap;
257275
258276 void SetUp() override {
277 Session.reset(new MockSession());
278
259279 InsertItemWithTag(PDB_SymType::None);
260280 InsertItemWithTag(PDB_SymType::Exe);
261281 InsertItemWithTag(PDB_SymType::Compiland);
290310 InsertItemWithTag(PDB_SymType::Max);
291311 }
292312
293 private:
294 void InsertItemWithTag(PDB_SymType Tag) {
295 auto RawSymbol = std::unique_ptr(new MockRawSymbol(Tag));
296 auto Symbol = PDBSymbol::create(std::move(RawSymbol));
297 SymbolMap.insert(std::make_pair(Tag, std::move(Symbol)));
298 }
299
300 public:
301313 template void VerifyDyncast(PDB_SymType Tag) {
302314 for (auto item = SymbolMap.begin(); item != SymbolMap.end(); ++item) {
303315 EXPECT_EQ(item->first == Tag, llvm::isa(*item->second));
312324
313325 EXPECT_EQ(should_match, llvm::isa(*item->second));
314326 }
327 }
328
329 private:
330 std::unique_ptr Session;
331
332 void InsertItemWithTag(PDB_SymType Tag) {
333 auto RawSymbol = std::unique_ptr(new MockRawSymbol(Tag));
334 auto Symbol = PDBSymbol::create(*Session, std::move(RawSymbol));
335 SymbolMap.insert(std::make_pair(Tag, std::move(Symbol)));
315336 }
316337 };
317338