1 //===-- PDBASTParser.h ------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
12 #include "lldb/lldb-forward.h"
14 #include "Plugins/ExpressionParser/Clang/ClangASTImporter.h"
25 namespace lldb_private
{
26 class TypeSystemClang
;
28 } // namespace lldb_private
32 template <typename ChildType
> class ConcreteSymbolEnumerator
;
37 class PDBSymbolTypeBaseClass
;
38 class PDBSymbolTypeBuiltin
;
39 class PDBSymbolTypeUDT
;
45 PDBASTParser(lldb_private::TypeSystemClang
&ast
);
48 lldb::TypeSP
CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol
&type
);
49 bool CompleteTypeFromPDB(lldb_private::CompilerType
&compiler_type
);
51 clang::Decl
*GetDeclForSymbol(const llvm::pdb::PDBSymbol
&symbol
);
54 GetDeclContextForSymbol(const llvm::pdb::PDBSymbol
&symbol
);
56 GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol
&symbol
);
58 void ParseDeclsForDeclContext(const clang::DeclContext
*decl_context
);
60 clang::NamespaceDecl
*FindNamespaceDecl(const clang::DeclContext
*parent
,
61 llvm::StringRef name
);
63 lldb_private::ClangASTImporter
&GetClangASTImporter() {
64 return m_ast_importer
;
68 typedef llvm::DenseMap
<clang::CXXRecordDecl
*, lldb::user_id_t
>
69 CXXRecordDeclToUidMap
;
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
>
73 ParentToNamespacesMap
;
74 typedef llvm::DenseMap
<clang::DeclContext
*, lldb::user_id_t
>
76 typedef llvm::pdb::ConcreteSymbolEnumerator
<llvm::pdb::PDBSymbolData
>
77 PDBDataSymbolEnumerator
;
78 typedef llvm::pdb::ConcreteSymbolEnumerator
<llvm::pdb::PDBSymbolTypeBaseClass
>
79 PDBBaseClassSymbolEnumerator
;
80 typedef llvm::pdb::ConcreteSymbolEnumerator
<llvm::pdb::PDBSymbolFunc
>
81 PDBFuncSymbolEnumerator
;
83 bool AddEnumValue(lldb_private::CompilerType enum_type
,
84 const llvm::pdb::PDBSymbolData
&data
);
85 bool CompleteTypeFromUDT(lldb_private::SymbolFile
&symbol_file
,
86 lldb_private::CompilerType
&compiler_type
,
87 llvm::pdb::PDBSymbolTypeUDT
&udt
);
89 AddRecordMembers(lldb_private::SymbolFile
&symbol_file
,
90 lldb_private::CompilerType
&record_type
,
91 PDBDataSymbolEnumerator
&members_enum
,
92 lldb_private::ClangASTImporter::LayoutInfo
&layout_info
);
94 AddRecordBases(lldb_private::SymbolFile
&symbol_file
,
95 lldb_private::CompilerType
&record_type
, int record_kind
,
96 PDBBaseClassSymbolEnumerator
&bases_enum
,
97 lldb_private::ClangASTImporter::LayoutInfo
&layout_info
) const;
98 void AddRecordMethods(lldb_private::SymbolFile
&symbol_file
,
99 lldb_private::CompilerType
&record_type
,
100 PDBFuncSymbolEnumerator
&methods_enum
);
101 clang::CXXMethodDecl
*
102 AddRecordMethod(lldb_private::SymbolFile
&symbol_file
,
103 lldb_private::CompilerType
&record_type
,
104 const llvm::pdb::PDBSymbolFunc
&method
) const;
106 lldb_private::TypeSystemClang
&m_ast
;
107 lldb_private::ClangASTImporter m_ast_importer
;
109 CXXRecordDeclToUidMap m_forward_decl_to_uid
;
110 UidToDeclMap m_uid_to_decl
;
111 ParentToNamespacesMap m_parent_to_namespaces
;
112 NamespacesSet m_namespaces
;
113 DeclContextToUidMap m_decl_context_to_uid
;
116 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H