LLDB  mainline
DWARFASTParserClang.h
Go to the documentation of this file.
1 //===-- DWARFASTParserClang.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 SymbolFileDWARF_DWARFASTParserClang_h_
10 #define SymbolFileDWARF_DWARFASTParserClang_h_
11 
12 #include "clang/AST/CharUnits.h"
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/ADT/SmallPtrSet.h"
15 #include "llvm/ADT/SmallVector.h"
16 
17 #include "DWARFASTParser.h"
18 #include "DWARFDefines.h"
19 #include "lldb/Core/ClangForward.h"
23 
24 #include <vector>
25 
26 namespace lldb_private {
27 class CompileUnit;
28 }
30 class SymbolFileDWARF;
31 
33 public:
35 
36  ~DWARFASTParserClang() override;
37 
38  // DWARFASTParser interface.
39  lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc,
40  const DWARFDIE &die, lldb_private::Log *log,
41  bool *type_is_new_ptr) override;
42 
44  ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit,
45  const DWARFDIE &die) override;
46 
47  bool
48  CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type,
49  lldb_private::CompilerType &compiler_type) override;
50 
52  GetDeclForUIDFromDWARF(const DWARFDIE &die) override;
53 
54  std::vector<DWARFDIE>
55  GetDIEForDeclContext(lldb_private::CompilerDeclContext decl_context) override;
56 
58  GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override;
59 
61  GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) override;
62 
63  lldb_private::ClangASTImporter &GetClangASTImporter();
64 
65 protected:
67  typedef std::vector<DelayedAddObjCClassProperty> DelayedPropertyList;
68 
69  clang::DeclContext *GetDeclContextForBlock(const DWARFDIE &die);
70 
71  clang::BlockDecl *ResolveBlockDIE(const DWARFDIE &die);
72 
73  clang::NamespaceDecl *ResolveNamespaceDIE(const DWARFDIE &die);
74 
75  bool ParseTemplateDIE(const DWARFDIE &die,
77  &template_param_infos);
78  bool ParseTemplateParameterInfos(
79  const DWARFDIE &parent_die,
81  &template_param_infos);
82 
83  bool ParseChildMembers(
84  const lldb_private::SymbolContext &sc, const DWARFDIE &die,
85  lldb_private::CompilerType &class_compiler_type,
86  const lldb::LanguageType class_language,
87  std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
88  std::vector<int> &member_accessibilities,
89  std::vector<DWARFDIE> &member_function_dies,
90  DelayedPropertyList &delayed_properties,
91  lldb::AccessType &default_accessibility, bool &is_a_class,
93 
94  size_t
95  ParseChildParameters(lldb_private::CompileUnit &comp_unit,
96  clang::DeclContext *containing_decl_ctx,
97  const DWARFDIE &parent_die, bool skip_artificial,
98  bool &is_static, bool &is_variadic,
99  bool &has_template_params,
100  std::vector<lldb_private::CompilerType> &function_args,
101  std::vector<clang::ParmVarDecl *> &function_param_decls,
102  unsigned &type_quals);
103 
104  size_t ParseChildEnumerators(const lldb_private::SymbolContext &sc,
105  lldb_private::CompilerType &compiler_type,
106  bool is_signed, uint32_t enumerator_byte_size,
107  const DWARFDIE &parent_die);
108 
109  lldb_private::Type *GetTypeForDIE(const DWARFDIE &die);
110 
111  clang::Decl *GetClangDeclForDIE(const DWARFDIE &die);
112 
113  clang::DeclContext *GetClangDeclContextForDIE(const DWARFDIE &die);
114 
115  clang::DeclContext *GetClangDeclContextContainingDIE(const DWARFDIE &die,
116  DWARFDIE *decl_ctx_die);
117 
118  bool CopyUniqueClassMethodTypes(const DWARFDIE &src_class_die,
119  const DWARFDIE &dst_class_die,
120  lldb_private::Type *class_type,
121  std::vector<DWARFDIE> &failures);
122 
123  clang::DeclContext *GetCachedClangDeclContextForDIE(const DWARFDIE &die);
124 
125  void LinkDeclContextToDIE(clang::DeclContext *decl_ctx, const DWARFDIE &die);
126 
127  void LinkDeclToDIE(clang::Decl *decl, const DWARFDIE &die);
128 
129  lldb::TypeSP ParseTypeFromDWO(const DWARFDIE &die, lldb_private::Log *log);
130 
131  // Return true if this type is a declaration to a type in an external
132  // module.
133  lldb::ModuleSP GetModuleForType(const DWARFDIE &die);
134 
135  typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
136  typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *>
138  // typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet>
139  // DeclContextToDIEMap;
140  typedef std::multimap<const clang::DeclContext *, const DWARFDIE>
142  typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::Decl *>
144  typedef llvm::DenseMap<const clang::Decl *, DIEPointerSet> DeclToDIEMap;
145 
148  DeclToDIEMap m_decl_to_die;
151  std::unique_ptr<lldb_private::ClangASTImporter> m_clang_ast_importer_up;
152 };
153 
154 #endif // SymbolFileDWARF_DWARFASTParserClang_h_
std::unique_ptr< lldb_private::ClangASTImporter > m_clang_ast_importer_up
DeclContextToDIEMap m_decl_ctx_to_die
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
std::multimap< const clang::DeclContext *, const DWARFDIE > DeclContextToDIEMap
A class that describes a function.
Definition: Function.h:323
A class that describes a compilation unit.
Definition: CompileUnit.h:35
DIEToDeclContextMap m_die_to_decl_ctx
LanguageType
Programming language type.
llvm::DenseMap< const DWARFDebugInfoEntry *, clang::Decl * > DIEToDeclMap
std::vector< DelayedAddObjCClassProperty > DelayedPropertyList
llvm::SmallPtrSet< const DWARFDebugInfoEntry *, 4 > DIEPointerSet
lldb_private::ClangASTContext & m_ast
llvm::DenseMap< const clang::Decl *, DIEPointerSet > DeclToDIEMap
llvm::DenseMap< const DWARFDebugInfoEntry *, clang::DeclContext * > DIEToDeclContextMap