1 //===-- DWARFASTParserClang.h -----------------------------------*- 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 SymbolFileDWARF_DWARFASTParserClang_h_
11 #define SymbolFileDWARF_DWARFASTParserClang_h_
15 // Other libraries and framework includes
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/SmallPtrSet.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "clang/AST/CharUnits.h"
22 #include "lldb/Core/ClangForward.h"
23 #include "lldb/Core/PluginInterface.h"
24 #include "lldb/Symbol/ClangASTContext.h"
25 #include "DWARFDefines.h"
26 #include "DWARFASTParser.h"
28 class DWARFDebugInfoEntry;
29 class DWARFDIECollection;
31 class DWARFASTParserClang : public DWARFASTParser
34 DWARFASTParserClang (lldb_private::ClangASTContext &ast);
36 ~DWARFASTParserClang() override;
39 ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
41 lldb_private::Log *log,
42 bool *type_is_new_ptr) override;
45 lldb_private::Function *
46 ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
47 const DWARFDIE &die) override;
50 CanCompleteType (const lldb_private::CompilerType &compiler_type) override;
53 CompleteType (const lldb_private::CompilerType &compiler_type) override;
56 CompleteTypeFromDWARF (const DWARFDIE &die,
57 lldb_private::Type *type,
58 lldb_private::CompilerType &compiler_type) override;
60 lldb_private::CompilerDecl
61 GetDeclForUIDFromDWARF (const DWARFDIE &die) override;
64 GetDIEForDeclContext (lldb_private::CompilerDeclContext decl_context) override;
66 lldb_private::CompilerDeclContext
67 GetDeclContextForUIDFromDWARF (const DWARFDIE &die) override;
69 lldb_private::CompilerDeclContext
70 GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) override;
73 LayoutRecordType(const clang::RecordDecl *record_decl,
76 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
77 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
78 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
81 class DelayedAddObjCClassProperty;
82 typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList;
96 llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
97 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
98 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> vbase_offsets;
102 ResolveBlockDIE (const DWARFDIE &die);
104 clang::NamespaceDecl *
105 ResolveNamespaceDIE (const DWARFDIE &die);
107 typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap;
110 ParseTemplateDIE (const DWARFDIE &die,
111 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
113 ParseTemplateParameterInfos (const DWARFDIE &parent_die,
114 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
117 ParseChildMembers (const lldb_private::SymbolContext& sc,
119 lldb_private::CompilerType &class_compiler_type,
120 const lldb::LanguageType class_language,
121 std::vector<clang::CXXBaseSpecifier *>& base_classes,
122 std::vector<int>& member_accessibilities,
123 DWARFDIECollection& member_function_dies,
124 DelayedPropertyList& delayed_properties,
125 lldb::AccessType &default_accessibility,
127 LayoutInfo &layout_info);
130 ParseChildParameters (const lldb_private::SymbolContext& sc,
131 clang::DeclContext *containing_decl_ctx,
132 const DWARFDIE &parent_die,
133 bool skip_artificial,
136 std::vector<lldb_private::CompilerType>& function_args,
137 std::vector<clang::ParmVarDecl*>& function_param_decls,
138 unsigned &type_quals);
141 ParseChildArrayInfo (const lldb_private::SymbolContext& sc,
142 const DWARFDIE &parent_die,
143 int64_t& first_index,
144 std::vector<uint64_t>& element_orders,
145 uint32_t& byte_stride,
146 uint32_t& bit_stride);
149 ParseChildEnumerators (const lldb_private::SymbolContext& sc,
150 lldb_private::CompilerType &compiler_type,
152 uint32_t enumerator_byte_size,
153 const DWARFDIE &parent_die);
156 GetTypeForDIE (const DWARFDIE &die);
159 GetClangDeclForDIE (const DWARFDIE &die);
162 GetClangDeclContextForDIE (const DWARFDIE &die);
165 GetClangDeclContextContainingDIE (const DWARFDIE &die,
166 DWARFDIE *decl_ctx_die);
169 CopyUniqueClassMethodTypes (const DWARFDIE &src_class_die,
170 const DWARFDIE &dst_class_die,
171 lldb_private::Type *class_type,
172 DWARFDIECollection &failures);
175 GetCachedClangDeclContextForDIE (const DWARFDIE &die);
178 LinkDeclContextToDIE (clang::DeclContext *decl_ctx,
179 const DWARFDIE &die);
182 LinkDeclToDIE (clang::Decl *decl, const DWARFDIE &die);
184 lldb_private::ClangASTImporter &
185 GetClangASTImporter();
188 ParseTypeFromDWO (const DWARFDIE &die, lldb_private::Log *log);
190 //----------------------------------------------------------------------
191 // Return true if this type is a declaration to a type in an external
193 //----------------------------------------------------------------------
195 GetModuleForType (const DWARFDIE &die);
197 typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
198 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
199 //typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap;
200 typedef std::multimap<const clang::DeclContext *, const DWARFDIE> DeclContextToDIEMap;
201 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::Decl *> DIEToDeclMap;
202 typedef llvm::DenseMap<const clang::Decl *, DIEPointerSet> DeclToDIEMap;
204 lldb_private::ClangASTContext &m_ast;
205 DIEToDeclMap m_die_to_decl;
206 DeclToDIEMap m_decl_to_die;
207 DIEToDeclContextMap m_die_to_decl_ctx;
208 DeclContextToDIEMap m_decl_ctx_to_die;
209 RecordDeclToLayoutMap m_record_decl_to_layout_map;
210 std::unique_ptr<lldb_private::ClangASTImporter> m_clang_ast_importer_ap;
213 #endif // SymbolFileDWARF_DWARFASTParserClang_h_