1 //===- PDBSymbol.h - base class for user-facing symbol types -----*- C++-*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_IPDBSYMBOL_H
11 #define LLVM_DEBUGINFO_PDB_IPDBSYMBOL_H
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/Support/Casting.h"
18 #include "IPDBRawSymbol.h"
21 #define FORWARD_SYMBOL_METHOD(MethodName) \
22 auto MethodName() const->decltype(RawSymbol->MethodName()) { \
23 return RawSymbol->MethodName(); \
31 /// PDBSymbol defines the base of the inheritance hierarchy for concrete symbol
32 /// types (e.g. functions, executables, vtables, etc). All concrete symbol
33 /// types inherit from PDBSymbol and expose the exact set of methods that are
34 /// valid for that particular symbol type, as described in the Microsoft
35 /// reference "Lexical and Class Hierarchy of Symbol Types":
36 /// https://msdn.microsoft.com/en-us/library/370hs6k4.aspx
39 PDBSymbol(const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol);
42 static std::unique_ptr<PDBSymbol>
43 create(const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol);
47 /// Dumps the contents of a symbol a raw_ostream. By default this will just
48 /// call dump() on the underlying RawSymbol, which allows us to discover
49 /// unknown properties, but individual implementations of PDBSymbol may
50 /// override the behavior to only dump known fields.
51 virtual void dump(llvm::raw_ostream &OS) const;
53 PDB_SymType getSymTag() const;
55 std::unique_ptr<IPDBEnumSymbols>
56 findChildren(PDB_SymType Type, StringRef Name,
57 PDB_NameSearchFlags Flags) const;
58 std::unique_ptr<IPDBEnumSymbols> findChildrenByRVA(PDB_SymType Type,
60 PDB_NameSearchFlags Flags,
62 std::unique_ptr<IPDBEnumSymbols> findInlineFramesByRVA(uint32_t RVA) const;
65 const IPDBSession &Session;
66 const std::unique_ptr<IPDBRawSymbol> RawSymbol;