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 "DWARFASTParser.h"
23 #include "DWARFDefines.h"
24 #include "lldb/Core/ClangForward.h"
25 #include "lldb/Core/PluginInterface.h"
26 #include "lldb/Symbol/ClangASTContext.h"
27 #include "lldb/Symbol/ClangASTImporter.h"
29 class DWARFDebugInfoEntry;
30 class DWARFDIECollection;
32 class DWARFASTParserClang : public DWARFASTParser
35 DWARFASTParserClang (lldb_private::ClangASTContext &ast);
37 ~DWARFASTParserClang() override;
39 // DWARFASTParser interface.
41 ParseTypeFromDWARF (const lldb_private::SymbolContext& sc,
43 lldb_private::Log *log,
44 bool *type_is_new_ptr) override;
47 lldb_private::Function *
48 ParseFunctionFromDWARF (const lldb_private::SymbolContext& sc,
49 const DWARFDIE &die) override;
52 CompleteTypeFromDWARF (const DWARFDIE &die,
53 lldb_private::Type *type,
54 lldb_private::CompilerType &compiler_type) override;
56 lldb_private::CompilerDecl
57 GetDeclForUIDFromDWARF (const DWARFDIE &die) override;
60 GetDIEForDeclContext (lldb_private::CompilerDeclContext decl_context) override;
62 lldb_private::CompilerDeclContext
63 GetDeclContextForUIDFromDWARF (const DWARFDIE &die) override;
65 lldb_private::CompilerDeclContext
66 GetDeclContextContainingUIDFromDWARF (const DWARFDIE &die) override;
68 lldb_private::ClangASTImporter &
69 GetClangASTImporter();
72 class DelayedAddObjCClassProperty;
73 typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList;
76 ResolveBlockDIE (const DWARFDIE &die);
78 clang::NamespaceDecl *
79 ResolveNamespaceDIE (const DWARFDIE &die);
82 ParseTemplateDIE (const DWARFDIE &die,
83 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
85 ParseTemplateParameterInfos (const DWARFDIE &parent_die,
86 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
89 ParseChildMembers(const lldb_private::SymbolContext &sc, const DWARFDIE &die,
90 lldb_private::CompilerType &class_compiler_type, const lldb::LanguageType class_language,
91 std::vector<clang::CXXBaseSpecifier *> &base_classes, std::vector<int> &member_accessibilities,
92 DWARFDIECollection &member_function_dies, DelayedPropertyList &delayed_properties,
93 lldb::AccessType &default_accessibility, bool &is_a_class,
94 lldb_private::ClangASTImporter::LayoutInfo &layout_info);
97 ParseChildParameters (const lldb_private::SymbolContext& sc,
98 clang::DeclContext *containing_decl_ctx,
99 const DWARFDIE &parent_die,
100 bool skip_artificial,
103 bool &has_template_params,
104 std::vector<lldb_private::CompilerType>& function_args,
105 std::vector<clang::ParmVarDecl*>& function_param_decls,
106 unsigned &type_quals);
109 ParseChildArrayInfo (const lldb_private::SymbolContext& sc,
110 const DWARFDIE &parent_die,
111 int64_t& first_index,
112 std::vector<uint64_t>& element_orders,
113 uint32_t& byte_stride,
114 uint32_t& bit_stride);
117 ParseChildEnumerators (const lldb_private::SymbolContext& sc,
118 lldb_private::CompilerType &compiler_type,
120 uint32_t enumerator_byte_size,
121 const DWARFDIE &parent_die);
124 GetTypeForDIE (const DWARFDIE &die);
127 GetClangDeclForDIE (const DWARFDIE &die);
130 GetClangDeclContextForDIE (const DWARFDIE &die);
133 GetClangDeclContextContainingDIE (const DWARFDIE &die,
134 DWARFDIE *decl_ctx_die);
137 CopyUniqueClassMethodTypes (const DWARFDIE &src_class_die,
138 const DWARFDIE &dst_class_die,
139 lldb_private::Type *class_type,
140 DWARFDIECollection &failures);
143 GetCachedClangDeclContextForDIE (const DWARFDIE &die);
146 LinkDeclContextToDIE (clang::DeclContext *decl_ctx,
147 const DWARFDIE &die);
150 LinkDeclToDIE (clang::Decl *decl, const DWARFDIE &die);
153 ParseTypeFromDWO (const DWARFDIE &die, lldb_private::Log *log);
155 //----------------------------------------------------------------------
156 // Return true if this type is a declaration to a type in an external
158 //----------------------------------------------------------------------
160 GetModuleForType (const DWARFDIE &die);
162 typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
163 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
164 //typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap;
165 typedef std::multimap<const clang::DeclContext *, const DWARFDIE> DeclContextToDIEMap;
166 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::Decl *> DIEToDeclMap;
167 typedef llvm::DenseMap<const clang::Decl *, DIEPointerSet> DeclToDIEMap;
169 lldb_private::ClangASTContext &m_ast;
170 DIEToDeclMap m_die_to_decl;
171 DeclToDIEMap m_decl_to_die;
172 DIEToDeclContextMap m_die_to_decl_ctx;
173 DeclContextToDIEMap m_decl_ctx_to_die;
174 std::unique_ptr<lldb_private::ClangASTImporter> m_clang_ast_importer_ap;
177 #endif // SymbolFileDWARF_DWARFASTParserClang_h_