LLDB  mainline
PDBASTParser.h
Go to the documentation of this file.
1 //===-- PDBASTParser.h ------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
11 
12 #include "lldb/lldb-forward.h"
13 
15 
16 class SymbolFilePDB;
17 
18 namespace clang {
19 class CharUnits;
20 class CXXRecordDecl;
21 class FieldDecl;
22 class RecordDecl;
23 } // namespace clang
24 
25 namespace lldb_private {
26 class TypeSystemClang;
27 class CompilerType;
28 } // namespace lldb_private
29 
30 namespace llvm {
31 namespace pdb {
32 template <typename ChildType> class ConcreteSymbolEnumerator;
33 
34 class PDBSymbol;
35 class PDBSymbolData;
36 class PDBSymbolFunc;
37 class PDBSymbolTypeBaseClass;
38 class PDBSymbolTypeBuiltin;
39 class PDBSymbolTypeUDT;
40 } // namespace pdb
41 } // namespace llvm
42 
43 class PDBASTParser {
44 public:
46  ~PDBASTParser();
47 
48  lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type);
50 
51  clang::Decl *GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol);
52 
53  clang::DeclContext *
54  GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol);
55  clang::DeclContext *
56  GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol);
57 
58  void ParseDeclsForDeclContext(const clang::DeclContext *decl_context);
59 
60  clang::NamespaceDecl *FindNamespaceDecl(const clang::DeclContext *parent,
61  llvm::StringRef name);
62 
64  return m_ast_importer;
65  }
66 
67 private:
68  typedef llvm::DenseMap<clang::CXXRecordDecl *, lldb::user_id_t>
70  typedef llvm::DenseMap<lldb::user_id_t, clang::Decl *> UidToDeclMap;
71  typedef std::set<clang::NamespaceDecl *> NamespacesSet;
72  typedef llvm::DenseMap<clang::DeclContext *, NamespacesSet>
74  typedef llvm::DenseMap<clang::DeclContext *, lldb::user_id_t>
82 
84  const llvm::pdb::PDBSymbolData &data);
86  lldb_private::CompilerType &compiler_type,
87  llvm::pdb::PDBSymbolTypeUDT &udt);
88  void
90  lldb_private::CompilerType &record_type,
91  PDBDataSymbolEnumerator &members_enum,
93  void
95  lldb_private::CompilerType &record_type, int record_kind,
96  PDBBaseClassSymbolEnumerator &bases_enum,
99  lldb_private::CompilerType &record_type,
100  PDBFuncSymbolEnumerator &methods_enum);
101  clang::CXXMethodDecl *
103  lldb_private::CompilerType &record_type,
104  const llvm::pdb::PDBSymbolFunc &method) const;
105 
108 
114 };
115 
116 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
PDBASTParser::GetDeclForSymbol
clang::Decl * GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol)
Definition: PDBASTParser.cpp:830
SymbolFilePDB
Definition: SymbolFilePDB.h:24
lldb_private::SymbolFile
Definition: SymbolFile.h:37
llvm
Definition: Debugger.h:49
PDBASTParser::GetClangASTImporter
lldb_private::ClangASTImporter & GetClangASTImporter()
Definition: PDBASTParser.h:63
PDBASTParser::ParentToNamespacesMap
llvm::DenseMap< clang::DeclContext *, NamespacesSet > ParentToNamespacesMap
Definition: PDBASTParser.h:73
PDBASTParser::m_forward_decl_to_uid
CXXRecordDeclToUidMap m_forward_decl_to_uid
Definition: PDBASTParser.h:109
PDBASTParser::PDBBaseClassSymbolEnumerator
llvm::pdb::ConcreteSymbolEnumerator< llvm::pdb::PDBSymbolTypeBaseClass > PDBBaseClassSymbolEnumerator
Definition: PDBASTParser.h:79
PDBASTParser::AddRecordMethods
void AddRecordMethods(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, PDBFuncSymbolEnumerator &methods_enum)
Definition: PDBASTParser.cpp:1394
PDBASTParser::AddEnumValue
bool AddEnumValue(lldb_private::CompilerType enum_type, const llvm::pdb::PDBSymbolData &data)
Definition: PDBASTParser.cpp:1143
lldb_private::ClangASTImporter::LayoutInfo
Definition: ClangASTImporter.h:66
PDBASTParser::CompleteTypeFromUDT
bool CompleteTypeFromUDT(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &compiler_type, llvm::pdb::PDBSymbolTypeUDT &udt)
Definition: PDBASTParser.cpp:1191
PDBASTParser::~PDBASTParser
~PDBASTParser()
PDBASTParser::AddRecordBases
void AddRecordBases(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, int record_kind, PDBBaseClassSymbolEnumerator &bases_enum, lldb_private::ClangASTImporter::LayoutInfo &layout_info) const
Definition: PDBASTParser.cpp:1344
PDBASTParser::ParseDeclsForDeclContext
void ParseDeclsForDeclContext(const clang::DeclContext *decl_context)
Definition: PDBASTParser.cpp:1093
PDBASTParser::FindNamespaceDecl
clang::NamespaceDecl * FindNamespaceDecl(const clang::DeclContext *parent, llvm::StringRef name)
Definition: PDBASTParser.cpp:1118
PDBASTParser::CXXRecordDeclToUidMap
llvm::DenseMap< clang::CXXRecordDecl *, lldb::user_id_t > CXXRecordDeclToUidMap
Definition: PDBASTParser.h:69
llvm::pdb::ConcreteSymbolEnumerator
Definition: PDBASTParser.h:32
PDBASTParser::PDBFuncSymbolEnumerator
llvm::pdb::ConcreteSymbolEnumerator< llvm::pdb::PDBSymbolFunc > PDBFuncSymbolEnumerator
Definition: PDBASTParser.h:81
PDBASTParser::AddRecordMembers
void AddRecordMembers(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, PDBDataSymbolEnumerator &members_enum, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
Definition: PDBASTParser.cpp:1231
PDBASTParser::m_parent_to_namespaces
ParentToNamespacesMap m_parent_to_namespaces
Definition: PDBASTParser.h:111
PDBASTParser::AddRecordMethod
clang::CXXMethodDecl * AddRecordMethod(lldb_private::SymbolFile &symbol_file, lldb_private::CompilerType &record_type, const llvm::pdb::PDBSymbolFunc &method) const
Definition: PDBASTParser.cpp:1404
PDBASTParser::DeclContextToUidMap
llvm::DenseMap< clang::DeclContext *, lldb::user_id_t > DeclContextToUidMap
Definition: PDBASTParser.h:75
PDBASTParser::m_uid_to_decl
UidToDeclMap m_uid_to_decl
Definition: PDBASTParser.h:110
PDBASTParser::GetDeclContextContainingSymbol
clang::DeclContext * GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol)
Definition: PDBASTParser.cpp:1019
PDBASTParser::m_ast_importer
lldb_private::ClangASTImporter m_ast_importer
Definition: PDBASTParser.h:107
PDBASTParser::m_ast
lldb_private::TypeSystemClang & m_ast
Definition: PDBASTParser.h:106
PDBASTParser::UidToDeclMap
llvm::DenseMap< lldb::user_id_t, clang::Decl * > UidToDeclMap
Definition: PDBASTParser.h:70
PDBASTParser::CreateLLDBTypeFromPDBType
lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type)
Definition: PDBASTParser.cpp:362
PDBASTParser::m_decl_context_to_uid
DeclContextToUidMap m_decl_context_to_uid
Definition: PDBASTParser.h:113
PDBASTParser::GetDeclContextForSymbol
clang::DeclContext * GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol)
Definition: PDBASTParser.cpp:991
PDBASTParser
Definition: PDBASTParser.h:43
PDBASTParser::CompleteTypeFromPDB
bool CompleteTypeFromPDB(lldb_private::CompilerType &compiler_type)
Definition: PDBASTParser.cpp:789
lldb_private::ClangASTImporter
Manages and observes all Clang AST node importing in LLDB.
Definition: ClangASTImporter.h:64
clang
Definition: ASTResultSynthesizer.h:15
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb-forward.h
PDBASTParser::PDBASTParser
PDBASTParser(lldb_private::TypeSystemClang &ast)
Definition: PDBASTParser.cpp:356
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
PDBASTParser::PDBDataSymbolEnumerator
llvm::pdb::ConcreteSymbolEnumerator< llvm::pdb::PDBSymbolData > PDBDataSymbolEnumerator
Definition: PDBASTParser.h:77
lldb_private::TypeSystemClang
A TypeSystem implementation based on Clang.
Definition: TypeSystemClang.h:106
ClangASTImporter.h
PDBASTParser::NamespacesSet
std::set< clang::NamespaceDecl * > NamespacesSet
Definition: PDBASTParser.h:71
PDBASTParser::m_namespaces
NamespacesSet m_namespaces
Definition: PDBASTParser.h:112