39#include "clang/AST/CXXInheritance.h"
40#include "clang/AST/DeclCXX.h"
41#include "clang/AST/DeclObjC.h"
42#include "clang/AST/DeclTemplate.h"
43#include "clang/AST/Type.h"
44#include "llvm/Demangle/Demangle.h"
53#ifdef ENABLE_DEBUG_PRINTF
55#define DEBUG_PRINTF(fmt, ...) printf(fmt, __VA_ARGS__)
57#define DEBUG_PRINTF(fmt, ...)
64 : m_ast(ast), m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
70 case clang::Decl::CXXRecord:
71 case clang::Decl::ClassTemplateSpecialization:
92 while (Parent.IsValid()) {
93 if (Parent.Tag() == DW_TAG_module)
106 parent = parent.GetParent()) {
108 if (tag == DW_TAG_module)
109 top_module_die = parent;
110 else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
114 return top_module_die;
123 if (clang_module_die) {
124 const char *module_name = clang_module_die.
GetName();
130 return lldb::ModuleSP();
137 if (!clang_module_sp)
143 llvm::SmallVector<CompilerContext, 4> decl_context;
150 llvm::DenseSet<SymbolFile *> searched_symbol_files;
151 clang_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
152 searched_symbol_files, pcm_types);
153 if (pcm_types.
Empty()) {
162 searched_symbol_files.insert(&sym_file);
165 module.GetSymbolFile()->FindTypes(decl_context, languages,
166 searched_symbol_files, pcm_types);
167 return pcm_types.GetSize();
201 auto type_sp =
dwarf->MakeType(
202 die.
GetID(), pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(
nullptr),
204 &pcm_type_sp->GetDeclaration(), type, Type::ResolveState::Forward,
206 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
221 lldbassert(started &&
"Unable to start a class type definition.");
235 clang::DeclContext *decl_ctx,
237 const char *type_name_cstr) {
238 auto *tag_decl_ctx = clang::dyn_cast<clang::TagDecl>(decl_ctx);
244 if (tag_decl_ctx->isCompleteDefinition() || tag_decl_ctx->isBeingDefined())
253 if (type && ast_importer.
CanImport(type)) {
258 "Unable to complete the Decl context for DIE {0} at offset "
259 "{1:x16}.\nPlease file a bug report.",
260 type_name_cstr ? type_name_cstr :
"", die.
GetOffset());
270 for (
size_t i = 0; i < attributes.
Size(); ++i) {
278 case DW_AT_abstract_origin:
282 case DW_AT_accessibility:
287 case DW_AT_artificial:
291 case DW_AT_bit_stride:
295 case DW_AT_byte_size:
299 case DW_AT_byte_stride:
303 case DW_AT_calling_convention:
307 case DW_AT_containing_type:
311 case DW_AT_decl_file:
316 case DW_AT_decl_line:
319 case DW_AT_decl_column:
323 case DW_AT_declaration:
331 case DW_AT_enum_class:
348 case DW_AT_linkage_name:
349 case DW_AT_MIPS_linkage_name:
357 case DW_AT_object_pointer:
361 case DW_AT_signature:
365 case DW_AT_specification:
373 case DW_AT_virtuality:
377 case DW_AT_APPLE_objc_complete_type:
381 case DW_AT_APPLE_objc_direct:
385 case DW_AT_APPLE_runtime_class:
389 case DW_AT_GNU_vector:
392 case DW_AT_export_symbols:
395 case DW_AT_rvalue_reference:
398 case DW_AT_reference:
407 return unit->GetAbsolutePath().GetPath();
408 return "<missing DWARF unit path>";
413 bool *type_is_new_ptr) {
415 *type_is_new_ptr =
false;
420 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
425 clang::DeclContext *context =
428 dwarf->GetObjectFile()->GetModule()->LogMessage(
430 "DWARFASTParserClang::ParseTypeFromDWARF "
431 "(die = {0:x16}, decl_ctx = {1:p} (die "
432 "{2:x16})) {3} name = '{4}')",
441 return type_ptr->shared_from_this();
450 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
451 if (clang::DeclContext *decl_ctx =
460 *type_is_new_ptr =
true;
468 case DW_TAG_base_type:
469 case DW_TAG_pointer_type:
470 case DW_TAG_reference_type:
471 case DW_TAG_rvalue_reference_type:
472 case DW_TAG_const_type:
473 case DW_TAG_restrict_type:
474 case DW_TAG_volatile_type:
475 case DW_TAG_atomic_type:
476 case DW_TAG_unspecified_type: {
481 case DW_TAG_structure_type:
482 case DW_TAG_union_type:
483 case DW_TAG_class_type: {
488 case DW_TAG_enumeration_type: {
493 case DW_TAG_inlined_subroutine:
494 case DW_TAG_subprogram:
495 case DW_TAG_subroutine_type: {
499 case DW_TAG_array_type: {
503 case DW_TAG_ptr_to_member_type: {
508 dwarf->GetObjectFile()->GetModule()->ReportError(
509 "[{0:x16}]: unhandled type tag {1:x4} ({2}), "
510 "please file a bug and "
511 "attach the file at the start of this error message",
526 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
535 if (tag == DW_TAG_typedef) {
585 encoding_uid.Reference());
591 case DW_TAG_unspecified_type:
592 if (attrs.
name ==
"nullptr_t" || attrs.
name ==
"decltype(nullptr)") {
593 resolve_state = Type::ResolveState::Full;
601 case DW_TAG_base_type:
602 resolve_state = Type::ResolveState::Full;
608 case DW_TAG_pointer_type:
611 case DW_TAG_reference_type:
614 case DW_TAG_rvalue_reference_type:
620 case DW_TAG_const_type:
623 case DW_TAG_restrict_type:
626 case DW_TAG_volatile_type:
629 case DW_TAG_atomic_type:
636 if (tag == DW_TAG_pointer_type) {
644 if (!strcmp(child_die.GetAttributeValueAsString(DW_AT_name,
""),
649 if (function_pointer_type) {
653 bool function_type_is_new_pointer;
655 sc, function_type, &function_type_is_new_pointer);
657 if (lldb_function_type_sp) {
659 lldb_function_type_sp->GetForwardCompilerType());
662 resolve_state = Type::ResolveState::Full;
675 if (attrs.
name ==
"id") {
677 dwarf->GetObjectFile()->GetModule()->LogMessage(
679 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} '{2}' "
680 "is Objective-C 'id' built-in type.",
685 resolve_state = Type::ResolveState::Full;
686 }
else if (attrs.
name ==
"Class") {
688 dwarf->GetObjectFile()->GetModule()->LogMessage(
690 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} '{2}' "
691 "is Objective-C 'Class' built-in type.",
696 resolve_state = Type::ResolveState::Full;
697 }
else if (attrs.
name ==
"SEL") {
699 dwarf->GetObjectFile()->GetModule()->LogMessage(
701 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} '{2}' "
702 "is Objective-C 'selector' built-in type.",
707 resolve_state = Type::ResolveState::Full;
716 if (encoding_die && encoding_die.
Tag() == DW_TAG_structure_type) {
717 llvm::StringRef struct_name = encoding_die.
GetName();
718 if (struct_name ==
"objc_object") {
720 dwarf->GetObjectFile()->GetModule()->LogMessage(
722 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} "
723 "'{2}' is 'objc_object*', which we overrode to "
729 resolve_state = Type::ResolveState::Full;
738 &attrs.
decl, clang_type, resolve_state,
741 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
747 if (llvm::StringRef(die.
GetName()).contains(
"<"))
760 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
770 type_sp =
dwarf->FindDefinitionTypeForDWARFDeclContext(die);
774 if (debug_map_symfile) {
783 dwarf->GetObjectFile()->GetModule()->LogMessage(
785 "SymbolFileDWARF({0:p}) - {1:x16}}: {2} type \"{3}\" is a "
786 "forward declaration, complete type is {4:x8}",
787 static_cast<void *
>(
this), die.
GetOffset(),
795 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
796 clang::DeclContext *defn_decl_ctx =
810 dwarf->GetForwardDeclDieToClangType().lookup(die.
GetDIE()));
813 Type *enumerator_type =
819 if (!enumerator_clang_type) {
822 "", DW_ATE_signed, *attrs.
byte_size * 8);
842 &attrs.
decl, clang_type, Type::ResolveState::Forward,
847 bool is_signed =
false;
854 dwarf->GetObjectFile()->GetModule()->ReportError(
855 "DWARF DIE at {0:x16} named \"{1}\" was not able to start its "
856 "definition.\nPlease file a bug and attach the file at the "
857 "start of this error message",
863static clang::CallingConv
866 case llvm::dwarf::DW_CC_normal:
868 case llvm::dwarf::DW_CC_BORLAND_stdcall:
869 return clang::CC_X86StdCall;
870 case llvm::dwarf::DW_CC_BORLAND_msfastcall:
871 return clang::CC_X86FastCall;
872 case llvm::dwarf::DW_CC_LLVM_vectorcall:
873 return clang::CC_X86VectorCall;
874 case llvm::dwarf::DW_CC_BORLAND_pascal:
875 return clang::CC_X86Pascal;
876 case llvm::dwarf::DW_CC_LLVM_Win64:
877 return clang::CC_Win64;
878 case llvm::dwarf::DW_CC_LLVM_X86_64SysV:
879 return clang::CC_X86_64SysV;
880 case llvm::dwarf::DW_CC_LLVM_X86RegCall:
881 return clang::CC_X86RegCall;
886 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
887 LLDB_LOG(log,
"Unsupported DW_AT_calling_convention value: {0}",
895 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
900 bool is_variadic =
false;
901 bool is_static =
false;
902 bool has_template_params =
false;
904 unsigned type_quals = 0;
906 std::string object_pointer_name;
909 if (object_pointer_name_cstr)
910 object_pointer_name = object_pointer_name_cstr;
917 Type *func_type =
nullptr;
927 std::vector<CompilerType> function_param_types;
928 std::vector<clang::ParmVarDecl *> function_param_decls;
933 clang::DeclContext *containing_decl_ctx =
935 const clang::Decl::Kind containing_decl_kind =
936 containing_decl_ctx->getDeclKind();
947 bool skip_artificial =
true;
949 is_variadic, has_template_params,
950 function_param_types, function_param_decls,
954 bool ignore_containing_context =
false;
965 if (is_cxx_method && has_template_params) {
966 ignore_containing_context =
true;
967 is_cxx_method =
false;
970 clang::CallingConv calling_convention =
977 function_param_types.size(), is_variadic,
978 type_quals, calling_convention, attrs.
ref_qual);
981 bool type_handled =
false;
982 if (tag == DW_TAG_subprogram || tag == DW_TAG_inlined_subroutine) {
983 std::optional<const ObjCLanguage::MethodName> objc_method =
987 ConstString class_name(objc_method->GetClassName());
989 TypeSP complete_objc_class_type_sp(
993 if (complete_objc_class_type_sp) {
995 complete_objc_class_type_sp->GetForwardCompilerType();
997 type_clang_forward_type))
998 class_opaque_type = type_clang_forward_type;
1002 if (class_opaque_type) {
1008 clang::ObjCMethodDecl *objc_method_decl =
1013 type_handled = objc_method_decl !=
nullptr;
1018 dwarf->GetObjectFile()->GetModule()->ReportError(
1019 "[{0:x16}]: invalid Objective-C method {1:x4} ({2}), "
1020 "please file a bug and attach the file at the start of "
1021 "this error message",
1025 }
else if (is_cxx_method) {
1028 Type *class_type =
dwarf->ResolveType(decl_ctx_die);
1030 if (class_type->
GetID() != decl_ctx_die.
GetID() ||
1038 if (class_type_die) {
1039 std::vector<DWARFDIE> failures;
1042 class_type, failures);
1051 return type_ptr->shared_from_this();
1066 clang::DeclContext *spec_clang_decl_ctx =
1068 if (spec_clang_decl_ctx) {
1071 dwarf->GetObjectFile()->GetModule()->ReportWarning(
1072 "{0:x8}: DW_AT_specification({1:x16}"
1076 type_handled =
true;
1085 clang::DeclContext *abs_clang_decl_ctx =
1087 if (abs_clang_decl_ctx) {
1090 dwarf->GetObjectFile()->GetModule()->ReportWarning(
1091 "{0:x8}: DW_AT_abstract_origin({1:x16}"
1095 type_handled =
true;
1106 type_handled =
true;
1108 llvm::PrettyStackTraceFormat stack_trace(
1109 "SymbolFileDWARF::ParseType() is adding a method "
1110 "%s to class %s in DIE 0x%8.8" PRIx64
" from %s",
1113 dwarf->GetObjectFile()->GetFileSpec().GetPath().c_str());
1115 const bool is_attr_used =
false;
1122 clang::CXXMethodDecl *cxx_method_decl =
1130 type_handled = cxx_method_decl !=
nullptr;
1135 if (cxx_method_decl) {
1141 if (!object_pointer_name.empty()) {
1144 "Setting object pointer name: %s on method "
1146 object_pointer_name.c_str(),
1147 static_cast<void *
>(cxx_method_decl));
1151 ignore_containing_context =
true;
1177 return type_ptr->shared_from_this();
1184 type_handled =
true;
1192 if (!type_handled) {
1193 clang::FunctionDecl *function_decl =
nullptr;
1194 clang::FunctionDecl *template_function_decl =
nullptr;
1199 if (
dwarf->ResolveType(abs_die)) {
1200 function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>(
1203 if (function_decl) {
1209 if (!function_decl) {
1210 char *name_buf =
nullptr;
1217 llvm::ItaniumPartialDemangler D;
1219 name_buf = D.getFunctionBaseName(
nullptr,
nullptr);
1227 : containing_decl_ctx,
1230 std::free(name_buf);
1232 if (has_template_params) {
1237 : containing_decl_ctx,
1240 clang::FunctionTemplateDecl *func_template_decl =
1243 template_function_decl, template_param_infos);
1245 template_function_decl, func_template_decl, template_param_infos);
1250 if (function_decl) {
1262 function_decl->addAttr(clang::AsmLabelAttr::CreateImplicit(
1267 if (!function_param_decls.empty()) {
1269 if (template_function_decl)
1271 function_param_decls);
1277 if (!object_pointer_name.empty()) {
1280 "Setting object pointer name: %s on function "
1282 object_pointer_name.c_str(),
1283 static_cast<void *
>(function_decl));
1290 return dwarf->MakeType(
1304 Type *element_type =
dwarf->ResolveTypeUID(type_die,
true);
1313 byte_stride = array_info->byte_stride;
1314 bit_stride = array_info->bit_stride;
1316 if (byte_stride == 0 && bit_stride == 0)
1317 byte_stride = element_type->
GetByteSize(
nullptr).value_or(0);
1321 uint64_t array_element_bit_stride = byte_stride * 8 + bit_stride;
1323 if (array_info && array_info->element_orders.size() > 0) {
1324 uint64_t num_elements = 0;
1325 auto end = array_info->element_orders.rend();
1326 for (
auto pos = array_info->element_orders.rbegin(); pos != end; ++pos) {
1327 num_elements = *pos;
1330 array_element_type = clang_type;
1331 array_element_bit_stride = num_elements
1332 ? array_element_bit_stride * num_elements
1333 : array_element_bit_stride;
1341 dwarf->MakeType(die.
GetID(), empty_name, array_element_bit_stride / 8,
1343 &attrs.
decl, clang_type, Type::ResolveState::Full);
1344 type_sp->SetEncodingType(element_type);
1359 if ((class_type ==
nullptr) || (pointee_type ==
nullptr))
1366 class_clang_type, pointee_clang_type);
1368 if (std::optional<uint64_t> clang_type_size =
1370 return dwarf->MakeType(die.
GetID(), attrs.
name, *clang_type_size,
nullptr,
1372 clang_type, Type::ResolveState::Forward);
1380 const lldb::ModuleSP &module_sp,
1381 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
1390 if (attributes.
Size() == 0)
1394 AccessType accessibility = default_accessibility;
1395 bool is_virtual =
false;
1396 bool is_base_of_class =
true;
1397 off_t member_byte_offset = 0;
1405 encoding_form = form_value;
1407 case DW_AT_data_member_location:
1409 Value initialValue(0);
1410 Value memberOffset(0);
1416 nullptr,
nullptr, module_sp,
1419 memberOffset,
nullptr)) {
1426 member_byte_offset = form_value.
Unsigned();
1430 case DW_AT_accessibility:
1435 case DW_AT_virtuality:
1436 is_virtual = form_value.
Boolean();
1446 if (base_class_type ==
nullptr) {
1447 module_sp->ReportError(
"{0:x16}: DW_TAG_inheritance failed to "
1448 "resolve the base class at {1:x16}"
1449 " from enclosing type {2:x16}. \nPlease file "
1450 "a bug and attach the file at the start of "
1451 "this error message",
1459 assert(base_class_clang_type);
1461 ast->SetObjCSuperClass(class_clang_type, base_class_clang_type);
1464 std::unique_ptr<clang::CXXBaseSpecifier> result =
1466 accessibility, is_virtual,
1471 base_classes.push_back(std::move(result));
1489 clang::CharUnits::fromQuantity(member_byte_offset)));
1503 if (sc_parent_tag == DW_TAG_compile_unit ||
1504 sc_parent_tag == DW_TAG_partial_unit) {
1506 }
else if (sc.
function !=
nullptr && sc_parent_die) {
1507 symbol_context_scope =
1509 if (symbol_context_scope ==
nullptr)
1510 symbol_context_scope = sc.
function;
1512 symbol_context_scope = sc.
module_sp.get();
1515 if (symbol_context_scope !=
nullptr)
1516 type_sp->SetSymbolContextScope(symbol_context_scope);
1518 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
1526 const char *name = die.
GetName();
1529 std::string qualified_name;
1532 while (parent_decl_ctx_die) {
1536 const dw_tag_t parent_tag = parent_decl_ctx_die.
Tag();
1537 switch (parent_tag) {
1538 case DW_TAG_namespace: {
1539 if (
const char *namespace_name = parent_decl_ctx_die.
GetName()) {
1540 qualified_name.insert(0,
"::");
1541 qualified_name.insert(0, namespace_name);
1543 qualified_name.insert(0,
"(anonymous namespace)::");
1549 case DW_TAG_class_type:
1550 case DW_TAG_structure_type:
1551 case DW_TAG_union_type: {
1552 if (
const char *class_union_struct_name = parent_decl_ctx_die.
GetName()) {
1553 qualified_name.insert(
1555 qualified_name.insert(0,
"::");
1556 qualified_name.insert(0, class_union_struct_name);
1563 parent_decl_ctx_die.
Clear();
1568 if (qualified_name.empty())
1569 qualified_name.append(
"::");
1571 qualified_name.append(name);
1574 return qualified_name;
1586 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
1592 auto unique_ast_entry_up = std::make_unique<UniqueDWARFASTType>();
1603 if (!qualified_name.empty())
1605 unique_decl.
Clear();
1608 if (
dwarf->GetUniqueDWARFASTTypeMap().Find(
1609 unique_typename, die, unique_decl, attrs.
byte_size.value_or(-1),
1610 *unique_ast_entry_up)) {
1611 type_sp = unique_ast_entry_up->m_type_sp;
1613 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
1624 int tag_decl_kind = -1;
1626 if (tag == DW_TAG_structure_type) {
1627 tag_decl_kind = clang::TTK_Struct;
1629 }
else if (tag == DW_TAG_union_type) {
1630 tag_decl_kind = clang::TTK_Union;
1632 }
else if (tag == DW_TAG_class_type) {
1633 tag_decl_kind = clang::TTK_Class;
1662 dwarf->FindCompleteObjCDefinitionTypeForDIE(die, attrs.
name,
true);
1666 dwarf->GetDebugMapSymfile();
1667 if (debug_map_symfile) {
1671 die, attrs.
name,
true);
1677 dwarf->GetObjectFile()->GetModule()->LogMessage(
1679 "SymbolFileDWARF({0:p}) - {1:x16}: {2} type "
1681 "incomplete objc type, complete type is {4:x8}",
1682 static_cast<void *
>(
this), die.
GetOffset(),
1690 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
1703 dwarf->GetObjectFile()->GetModule()->LogMessage(
1705 "SymbolFileDWARF({0:p}) - {1:x16}: {2} type \"{3}\" is a "
1706 "forward declaration, trying to find complete type",
1719 type_sp =
dwarf->FindDefinitionTypeForDWARFDeclContext(die);
1723 if (debug_map_symfile) {
1732 dwarf->GetObjectFile()->GetModule()->LogMessage(
1734 "SymbolFileDWARF({0:p}) - {1:x16}: {2} type \"{3}\" is a "
1735 "forward declaration, complete type is {4:x8}",
1736 static_cast<void *
>(
this), die.
GetOffset(),
1743 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
1744 clang::DeclContext *defn_decl_ctx =
1751 assert(tag_decl_kind != -1);
1752 (void)tag_decl_kind;
1753 bool clang_type_was_created =
false;
1756 dwarf->GetForwardDeclDieToClangType().lookup(die.
GetDIE()));
1758 clang::DeclContext *decl_ctx =
1767 const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
1778 clang::ClassTemplateDecl *class_template_decl =
1782 if (!class_template_decl) {
1784 dwarf->GetObjectFile()->GetModule()->LogMessage(
1786 "SymbolFileDWARF({0:p}) - {1:x16}: {2} type \"{3}\" "
1787 "clang::ClassTemplateDecl failed to return a decl.",
1788 static_cast<void *
>(
this), die.
GetOffset(),
1794 clang::ClassTemplateSpecializationDecl *class_specialization_decl =
1797 tag_decl_kind, template_param_infos);
1799 class_specialization_decl);
1800 clang_type_was_created =
true;
1806 if (!clang_type_was_created) {
1807 clang_type_was_created =
true;
1819 type_sp =
dwarf->MakeType(
1822 Type::ResolveState::Forward,
1828 unique_ast_entry_up->m_type_sp = type_sp;
1829 unique_ast_entry_up->m_die = die;
1830 unique_ast_entry_up->m_declaration = unique_decl;
1831 unique_ast_entry_up->m_byte_size = attrs.
byte_size.value_or(0);
1832 dwarf->GetUniqueDWARFASTTypeMap().Insert(unique_typename,
1833 *unique_ast_entry_up);
1845 dwarf->GetObjectFile()->GetModule()->ReportError(
1847 "DWARF DIE at {0:x16} named \"{1}\" was not able to start "
1849 "definition.\nPlease file a bug and attach the file at the "
1850 "start of this error message",
1860 clang::RecordDecl *record_decl =
1868 }
else if (clang_type_was_created) {
1886 assert(!
dwarf->GetForwardDeclClangTypeToDie().count(
1889 "Type already in the forward declaration map!");
1893 dwarf->GetForwardDeclDieToClangType()[die.
GetDIE()] =
1895 dwarf->GetForwardDeclClangTypeToDie().try_emplace(
1907 clang::CXXRecordDecl *record_decl =
1909 if (record_decl && record_decl->getDefinition()) {
1910 record_decl->setHasTrivialSpecialMemberForCall();
1915 clang::CXXRecordDecl *record_decl =
1918 record_decl->setArgPassingRestrictions(
1919 clang::RecordDecl::APK_CannotPassInRegs);
1929 const CompilerType &class_opaque_type,
const char *property_name,
1933 const char *property_setter_name,
const char *property_getter_name,
1940 if (metadata !=
nullptr) {
1987 bool is_template_template_argument =
false;
1990 case DW_TAG_GNU_template_parameter_pack: {
1992 std::make_unique<TypeSystemClang::TemplateParameterInfos>());
1997 if (
const char *name = die.
GetName()) {
2002 case DW_TAG_GNU_template_template_param:
2003 is_template_template_argument =
true;
2005 case DW_TAG_template_type_parameter:
2006 case DW_TAG_template_value_parameter: {
2008 if (attributes.
Size() == 0)
2011 const char *name =
nullptr;
2012 const char *template_name =
nullptr;
2014 uint64_t uval64 = 0;
2015 bool uval64_valid =
false;
2016 bool is_default_template_arg =
false;
2018 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2027 case DW_AT_GNU_template_name:
2040 case DW_AT_const_value:
2042 uval64_valid =
true;
2046 case DW_AT_default_value:
2048 is_default_template_arg = form_value.
Boolean();
2059 if (!is_template_template_argument) {
2060 bool is_signed =
false;
2064 if (name && !name[0])
2067 if (tag == DW_TAG_template_value_parameter && uval64_valid) {
2068 std::optional<uint64_t> size = clang_type.
GetBitSize(
nullptr);
2071 llvm::APInt apint(*size, uval64, is_signed);
2073 name, clang::TemplateArgument(ast, llvm::APSInt(apint, !is_signed),
2075 is_default_template_arg));
2080 is_default_template_arg));
2085 name, clang::TemplateArgument(clang::TemplateName(tplt_type),
2086 is_default_template_arg));
2108 case DW_TAG_template_type_parameter:
2109 case DW_TAG_template_value_parameter:
2110 case DW_TAG_GNU_template_parameter_pack:
2111 case DW_TAG_GNU_template_template_param:
2120 return !template_param_infos.
IsEmpty() ||
2133 const bool type_is_objc_object_or_interface =
2135 if (type_is_objc_object_or_interface) {
2142 if (tag == DW_TAG_structure_type) {
2144 }
else if (tag == DW_TAG_union_type) {
2146 }
else if (tag == DW_TAG_class_type) {
2150 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases;
2152 std::vector<DWARFDIE> member_function_dies;
2156 delayed_properties, default_accessibility, layout_info);
2159 for (
const DWARFDIE &die : member_function_dies)
2160 dwarf->ResolveType(die);
2162 if (type_is_objc_object_or_interface) {
2165 dwarf->GetObjCMethods(class_name, [&](
DWARFDIE method_die) {
2171 property.Finalize();
2175 if (!bases.empty()) {
2179 for (
const auto &base_class : bases) {
2180 clang::TypeSourceInfo *type_source_info =
2181 base_class->getTypeSourceInfo();
2182 if (type_source_info)
2204 clang::CXXRecordDecl *record_decl =
2210 return (
bool)clang_type;
2218 bool is_signed =
false;
2225 return (
bool)clang_type;
2233 std::lock_guard<std::recursive_mutex> guard(
2234 dwarf->GetObjectFile()->GetModule()->GetMutex());
2247 case DW_TAG_structure_type:
2248 case DW_TAG_union_type:
2249 case DW_TAG_class_type:
2251 case DW_TAG_enumeration_type:
2254 assert(
false &&
"not a forward clang type decl!");
2263 auto opaque_decl_ctx =
2274 if (clang_decl !=
nullptr)
2289 clang::DeclContext *clang_decl_ctx =
2302 size_t enumerators_added = 0;
2306 if (tag != DW_TAG_enumerator)
2310 if (attributes.
Size() == 0)
2313 const char *name =
nullptr;
2314 bool got_value =
false;
2315 int64_t enum_value = 0;
2318 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2323 case DW_AT_const_value:
2326 enum_value = form_value.
Signed();
2328 enum_value = form_value.
Unsigned();
2335 case DW_AT_description:
2337 case DW_AT_decl_file:
2341 case DW_AT_decl_line:
2344 case DW_AT_decl_column:
2353 if (name && name[0] && got_value) {
2355 clang_type, decl, name, enum_value, enumerator_byte_size * 8);
2356 ++enumerators_added;
2359 return enumerators_added;
2364 bool is_static =
false;
2365 bool is_variadic =
false;
2366 bool has_template_params =
false;
2367 unsigned type_quals = 0;
2368 std::vector<CompilerType> param_types;
2369 std::vector<clang::ParmVarDecl *> param_decls;
2375 clang::DeclContext *containing_decl_ctx =
2378 has_template_params, param_types, param_decls,
2381 for (
size_t i = 0; i < param_types.size(); i++) {
2384 sstr << param_types[i].GetTypeName();
2389 if (type_quals & clang::Qualifiers::Const)
2401 const char *name =
nullptr;
2402 const char *mangled =
nullptr;
2403 std::optional<int> decl_file;
2404 std::optional<int> decl_line;
2405 std::optional<int> decl_column;
2406 std::optional<int> call_file;
2407 std::optional<int> call_line;
2408 std::optional<int> call_column;
2413 if (tag != DW_TAG_subprogram)
2417 decl_column, call_file, call_line, call_column,
2422 else if ((die.
GetParent().
Tag() == DW_TAG_compile_unit ||
2428 name && strcmp(name,
"main") != 0) {
2437 std::unique_ptr<Declaration> decl_up;
2438 if (decl_file || decl_line || decl_column)
2439 decl_up = std::make_unique<Declaration>(
2441 decl_line ? *decl_line : 0, decl_column ? *decl_column : 0);
2451 std::make_shared<Function>(&comp_unit,
2453 func_user_id, func_name, func_type,
2456 if (func_sp.get() !=
nullptr) {
2458 func_sp->GetFrameBaseExpression() = frame_base;
2460 return func_sp.get();
2468struct MemberAttributes {
2470 ModuleSP module_sp);
2471 const char *name =
nullptr;
2474 int64_t bit_offset = 0;
2476 size_t bit_size = 0;
2479 std::optional<uint64_t> byte_size;
2480 std::optional<DWARFFormValue> const_value_form;
2485 bool is_artificial =
false;
2490struct PropertyAttributes {
2491 explicit PropertyAttributes(
const DWARFDIE &die);
2492 const char *prop_name =
nullptr;
2493 const char *prop_getter_name =
nullptr;
2494 const char *prop_setter_name =
nullptr;
2500MemberAttributes::MemberAttributes(
const DWARFDIE &die,
2502 ModuleSP module_sp) {
2503 member_byte_offset = (parent_die.
Tag() == DW_TAG_union_type) ? 0 :
UINT32_MAX;
2506 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2515 encoding_form = form_value;
2517 case DW_AT_bit_offset:
2518 bit_offset = form_value.
Signed();
2520 case DW_AT_bit_size:
2523 case DW_AT_byte_size:
2526 case DW_AT_const_value:
2527 const_value_form = form_value;
2529 case DW_AT_data_bit_offset:
2530 data_bit_offset = form_value.
Unsigned();
2532 case DW_AT_data_member_location:
2534 Value initialValue(0);
2535 Value memberOffset(0);
2546 memberOffset,
nullptr)) {
2547 member_byte_offset = memberOffset.ResolveValue(
nullptr).UInt();
2553 member_byte_offset = form_value.
Unsigned();
2557 case DW_AT_accessibility:
2561 case DW_AT_artificial:
2562 is_artificial = form_value.
Boolean();
2582 if (byte_size.value_or(0) == 0 && bit_offset < 0) {
2588PropertyAttributes::PropertyAttributes(
const DWARFDIE &die) {
2591 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2596 case DW_AT_APPLE_property_name:
2599 case DW_AT_APPLE_property_getter:
2600 prop_getter_name = form_value.
AsCString();
2602 case DW_AT_APPLE_property_setter:
2603 prop_setter_name = form_value.
AsCString();
2605 case DW_AT_APPLE_property_attribute:
2606 prop_attributes = form_value.
Unsigned();
2620 if (prop_getter_name && prop_getter_name[0] ==
'-') {
2621 std::optional<const ObjCLanguage::MethodName> prop_getter_method =
2623 if (prop_getter_method)
2628 if (prop_setter_name && prop_setter_name[0] ==
'-') {
2629 std::optional<const ObjCLanguage::MethodName> prop_setter_method =
2631 if (prop_setter_method)
2637 if (!prop_getter_name)
2638 prop_getter_name = prop_name;
2639 if (!prop_setter_name && prop_name[0] &&
2640 !(prop_attributes & DW_APPLE_PROPERTY_readonly)) {
2643 ss.
Printf(
"set%c%s:", toupper(prop_name[0]), &prop_name[1]);
2646 prop_setter_name = fixed_setter.
GetCString();
2655 assert(die.
Tag() == DW_TAG_APPLE_property);
2659 const MemberAttributes attrs(die, parent_die, module_sp);
2660 const PropertyAttributes propAttrs(die);
2662 if (!propAttrs.prop_name) {
2663 module_sp->ReportError(
"{0:x8}: DW_TAG_APPLE_property has no name.",
2670 module_sp->ReportError(
2671 "{0:x8}: DW_TAG_APPLE_property '{1}' refers to type {2:x16}"
2672 " which was unable to be parsed",
2673 die.
GetID(), propAttrs.prop_name,
2674 attrs.encoding_form.Reference().GetOffset());
2681 class_clang_type, propAttrs.prop_name,
2683 propAttrs.prop_getter_name, propAttrs.prop_attributes, &metadata));
2689 assert(qt->isIntegralOrEnumerationType());
2692 return llvm::createStringError(llvm::inconvertibleErrorCode(),
2693 "TypeSystem not clang");
2697 const unsigned type_bits = ast.getIntWidth(qt);
2698 const bool is_unsigned = qt->isUnsignedIntegerType();
2702 constexpr std::size_t max_bit_size = 64;
2707 if (type_bits > max_bit_size) {
2708 auto msg = llvm::formatv(
"Can only parse integers with up to {0} bits, but "
2709 "given integer has {1} bits.",
2710 max_bit_size, type_bits);
2711 return llvm::createStringError(llvm::inconvertibleErrorCode(), msg.str());
2715 llvm::APInt result(max_bit_size, form_value.
Unsigned(), !is_unsigned);
2721 const unsigned required_bits =
2722 is_unsigned ? result.getActiveBits() : result.getSignificantBits();
2725 if (required_bits > type_bits) {
2726 std::string value_as_str = is_unsigned
2727 ? std::to_string(form_value.
Unsigned())
2728 : std::to_string(form_value.
Signed());
2729 auto msg = llvm::formatv(
"Can't store {0} value {1} in integer with {2} "
2731 (is_unsigned ?
"unsigned" :
"signed"),
2732 value_as_str, type_bits);
2733 return llvm::createStringError(llvm::inconvertibleErrorCode(), msg.str());
2737 if (result.getBitWidth() > type_bits)
2738 result = result.trunc(type_bits);
2748 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
2750 assert(die.
Tag() == DW_TAG_member);
2755 const uint64_t parent_byte_size =
2757 const uint64_t parent_bit_size =
2761 MemberAttributes attrs(die, parent_die, module_sp);
2763 const bool class_is_objc_object_or_interface =
2767 if (class_is_objc_object_or_interface)
2772 if (attrs.member_byte_offset ==
UINT32_MAX &&
2781 class_clang_type, attrs.name, ct, attrs.accessibility);
2783 LLDB_LOG(log,
"Failed to add variable to the record type");
2792 llvm::Expected<llvm::APInt> const_value_or_err =
2794 if (!const_value_or_err) {
2796 "Failed to add const value to variable {1}: {0}",
2797 v->getQualifiedNameAsString());
2809 module_sp->ReportError(
2810 "{0:x8}: DW_TAG_member '{1}' refers to type {2:x16}"
2811 " which was unable to be parsed",
2812 die.
GetID(), attrs.name, attrs.encoding_form.Reference().GetOffset());
2814 module_sp->ReportError(
"{0:x8}: DW_TAG_member refers to type {1:x16}"
2815 " which was unable to be parsed",
2817 attrs.encoding_form.Reference().GetOffset());
2821 const uint64_t character_width = 8;
2822 const uint64_t word_width = 32;
2826 attrs.accessibility = default_accessibility;
2828 uint64_t field_bit_offset = (attrs.member_byte_offset ==
UINT32_MAX
2830 : (attrs.member_byte_offset * 8ULL));
2832 if (attrs.bit_size > 0) {
2834 this_field_info.
bit_offset = field_bit_offset;
2835 this_field_info.
bit_size = attrs.bit_size;
2838 this_field_info.
bit_offset = attrs.data_bit_offset;
2840 if (!attrs.byte_size)
2841 attrs.byte_size = member_type->
GetByteSize(
nullptr);
2845 this_field_info.
bit_offset += attrs.byte_size.value_or(0) * 8;
2846 this_field_info.
bit_offset -= (attrs.bit_offset + attrs.bit_size);
2848 this_field_info.
bit_offset += attrs.bit_offset;
2859 !(parent_die.
Tag() == DW_TAG_union_type &&
2861 ((this_field_info.
bit_offset >= parent_bit_size) ||
2867 "{0:x16}: {1} bitfield named \"{2}\" has invalid "
2868 "bit offset ({3:x8}) member will be ignored. Please file a bug "
2870 "compiler and include the preprocessed output for {4}\n",
2877 field_bit_offset = this_field_info.
bit_offset;
2882 bool detect_unnamed_bitfields =
true;
2884 if (class_is_objc_object_or_interface)
2885 detect_unnamed_bitfields =
2888 if (detect_unnamed_bitfields) {
2889 std::optional<FieldInfo> unnamed_field_info;
2890 uint64_t last_field_end =
2898 if (last_field_end != 0 && ((last_field_end % word_width) != 0))
2899 last_field_end += word_width - (last_field_end % word_width);
2903 this_field_info, layout_info)) {
2907 unnamed_field_info->bit_offset = last_field_end;
2910 if (unnamed_field_info) {
2911 clang::FieldDecl *unnamed_bitfield_decl =
2913 class_clang_type, llvm::StringRef(),
2916 attrs.accessibility, unnamed_field_info->bit_size);
2919 unnamed_bitfield_decl, unnamed_field_info->bit_offset));
2923 last_field_info = this_field_info;
2926 last_field_info.
bit_offset = field_bit_offset;
2928 if (std::optional<uint64_t> clang_type_size =
2930 last_field_info.
bit_size = *clang_type_size * character_width;
2944 if (attrs.is_artificial) {
2960 uint64_t member_array_size;
2961 bool member_array_is_incomplete;
2963 if (member_clang_type.
IsArrayType(&member_array_element_type,
2965 &member_array_is_incomplete) &&
2966 !member_array_is_incomplete) {
2967 uint64_t parent_byte_size =
2970 if (attrs.member_byte_offset >= parent_byte_size) {
2971 if (member_array_size != 1 &&
2972 (member_array_size != 0 ||
2973 attrs.member_byte_offset > parent_byte_size)) {
2974 module_sp->ReportError(
2975 "{0:x8}: DW_TAG_member '{1}' refers to type {2:x16}"
2976 " which extends beyond the bounds of {3:x8}",
2977 die.
GetID(), attrs.name,
2978 attrs.encoding_form.Reference().GetOffset(), parent_die.
GetID());
2990 class_clang_type, attrs.name, member_clang_type, attrs.accessibility,
2996 std::make_pair(field_decl, field_bit_offset));
3001 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
3002 std::vector<DWARFDIE> &member_function_dies,
3021 case DW_TAG_APPLE_property:
3027 default_accessibility, layout_info, last_field_info);
3030 case DW_TAG_subprogram:
3032 member_function_dies.push_back(die);
3035 case DW_TAG_inheritance:
3037 module_sp, base_classes, layout_info);
3049 clang::DeclContext *containing_decl_ctx,
const DWARFDIE &parent_die,
3050 bool skip_artificial,
bool &is_static,
bool &is_variadic,
3051 bool &has_template_params, std::vector<CompilerType> &function_param_types,
3052 std::vector<clang::ParmVarDecl *> &function_param_decls,
3053 unsigned &type_quals) {
3061 case DW_TAG_formal_parameter: {
3063 if (attributes.
Size() == 0) {
3068 const char *name =
nullptr;
3070 bool is_artificial =
false;
3073 clang::StorageClass storage = clang::SC_None;
3075 for (i = 0; i < attributes.
Size(); ++i) {
3084 param_type_die_form = form_value;
3086 case DW_AT_artificial:
3087 is_artificial = form_value.
Boolean();
3089 case DW_AT_location:
3090 case DW_AT_const_value:
3091 case DW_AT_default_value:
3092 case DW_AT_description:
3093 case DW_AT_endianity:
3094 case DW_AT_is_optional:
3096 case DW_AT_variable_parameter:
3098 case DW_AT_abstract_origin:
3106 if (skip_artificial && is_artificial) {
3114 (name ==
nullptr || ::strcmp(name,
"this") == 0)) {
3122 type_quals |= clang::Qualifiers::Const;
3124 type_quals |= clang::Qualifiers::Volatile;
3139 assert(param_var_decl);
3140 function_param_decls.push_back(param_var_decl);
3148 case DW_TAG_unspecified_parameters:
3152 case DW_TAG_template_type_parameter:
3153 case DW_TAG_template_value_parameter:
3154 case DW_TAG_GNU_template_parameter_pack:
3160 has_template_params =
true;
3179 if (attributes.
Size() == 0)
3183 for (
size_t i = 0; i < attributes.
Size(); ++i) {
3198 switch (die.
Tag()) {
3199 case DW_TAG_variable:
3200 case DW_TAG_constant:
3201 case DW_TAG_formal_parameter:
3202 case DW_TAG_imported_declaration:
3203 case DW_TAG_imported_module:
3211 return cache_pos->second;
3226 clang::Decl *decl =
nullptr;
3227 switch (die.
Tag()) {
3228 case DW_TAG_variable:
3229 case DW_TAG_constant:
3230 case DW_TAG_formal_parameter: {
3233 if (
dwarf && type) {
3234 const char *name = die.
GetName();
3235 clang::DeclContext *decl_context =
3237 dwarf->GetDeclContextContainingUID(die.
GetID()));
3244 case DW_TAG_imported_declaration: {
3249 if (imported_decl) {
3250 clang::DeclContext *decl_context =
3252 dwarf->GetDeclContextContainingUID(die.
GetID()));
3253 if (clang::NamedDecl *clang_imported_decl =
3254 llvm::dyn_cast<clang::NamedDecl>(
3262 case DW_TAG_imported_module: {
3269 if (imported_decl_ctx) {
3270 clang::DeclContext *decl_context =
3272 dwarf->GetDeclContextContainingUID(die.
GetID()));
3273 if (clang::NamespaceDecl *ns_decl =
3298 bool try_parsing_type =
true;
3299 switch (die.
Tag()) {
3300 case DW_TAG_compile_unit:
3301 case DW_TAG_partial_unit:
3303 try_parsing_type =
false;
3306 case DW_TAG_namespace:
3308 try_parsing_type =
false;
3311 case DW_TAG_imported_declaration:
3313 try_parsing_type =
false;
3316 case DW_TAG_lexical_block:
3318 try_parsing_type =
false;
3325 if (decl_ctx ==
nullptr && try_parsing_type) {
3345 parent = parent.GetParent()) {
3347 if (tag == DW_TAG_module) {
3367 switch (die.
Tag()) {
3368 case DW_TAG_subprogram:
3369 case DW_TAG_inlined_subroutine:
3379 if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) {
3386 assert(0 &&
"Shouldn't call GetContainingFunctionWithAbstractOrigin on "
3387 "something not in a function");
3393 if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) {
3415 assert(die.
Tag() == DW_TAG_lexical_block);
3416 DWARFDIE containing_function_with_abstract_origin =
3418 if (!containing_function_with_abstract_origin) {
3422 die, containing_function_with_abstract_origin);
3429 if (die && die.
Tag() == DW_TAG_lexical_block) {
3430 clang::BlockDecl *decl =
3435 clang::DeclContext *decl_context =
3449clang::NamespaceDecl *
3451 if (die && die.
Tag() == DW_TAG_namespace) {
3454 clang::NamespaceDecl *namespace_decl =
3457 return namespace_decl;
3459 const char *namespace_name = die.
GetName();
3460 clang::DeclContext *containing_decl_ctx =
3471 return namespace_decl;
3477clang::NamespaceDecl *
3479 assert(die && die.
Tag() == DW_TAG_imported_declaration);
3485 return static_cast<clang::NamespaceDecl *
>(it->getSecond());
3487 clang::NamespaceDecl *namespace_decl =
nullptr;
3494 switch (imported_uid.
Tag()) {
3495 case DW_TAG_imported_declaration:
3498 case DW_TAG_namespace:
3505 if (!namespace_decl)
3510 return namespace_decl;
3517 DWARFDIE decl_ctx_die =
dwarf->GetDeclContextDIEContainingDIE(die);
3519 if (decl_ctx_die_copy)
3520 *decl_ctx_die_copy = decl_ctx_die;
3523 clang::DeclContext *clang_decl_ctx =
3526 return clang_decl_ctx;
3552 if (!class_type || !src_class_die || !dst_class_die)
3554 if (src_class_die.
Tag() != dst_class_die.
Tag())
3564 if (die.
Tag() != DW_TAG_subprogram)
3576 map_artificial.Append(const_name, die);
3578 map.Append(const_name, die);
3587 src_die = src_die.GetSibling()) {
3588 gather(src_die, src_name_to_die, src_name_to_die_artificial);
3591 dst_die = dst_die.GetSibling()) {
3592 gather(dst_die, dst_name_to_die, dst_name_to_die_artificial);
3598 bool fast_path =
true;
3600 if (src_size != dst_size)
3606 for (idx = 0; idx < src_size; ++idx) {
3610 if (src_die.
Tag() != dst_die.
Tag())
3617 if (src_name == dst_name || (strcmp(src_name, dst_name) == 0))
3633 clang::DeclContext *dst_decl_ctx =
3638 if (
Type *src_child_type = die_to_type[src.
GetDIE()])
3639 die_to_type[dst.GetDIE()] = src_child_type;
3646 for (idx = 0; idx < src_size; ++idx) {
3656 src_name_to_die.
Sort();
3658 for (idx = 0; idx < dst_size; ++idx) {
3663 if (src_die && (src_die.
Tag() == dst_die.
Tag()))
3664 link(src_die, dst_die);
3666 failures.push_back(dst_die);
3671 const uint32_t src_size_artificial = src_name_to_die_artificial.
GetSize();
3672 const uint32_t dst_size_artificial = dst_name_to_die_artificial.
GetSize();
3674 if (src_size_artificial && dst_size_artificial) {
3675 dst_name_to_die_artificial.
Sort();
3677 for (idx = 0; idx < src_size_artificial; ++idx) {
3683 dst_name_to_die_artificial.
Find(src_name_artificial,
DWARFDIE());
3687 link(src_die, dst_die);
3691 if (dst_size_artificial) {
3692 for (idx = 0; idx < dst_size_artificial; ++idx) {
3698 return !failures.empty();
3702 FieldInfo const &last_field_info, uint64_t last_field_end,
3707 if (this_field_info.
bit_offset <= last_field_end)
3721 const bool have_base = layout_info.
base_offsets.size() != 0;
3722 const bool this_is_first_field =
3724 const bool first_field_is_vptr =
3727 if (have_base && (this_is_first_field || first_field_is_vptr))
static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind)
static std::string GetUnitName(const DWARFDIE &die)
static void ForcefullyCompleteType(CompilerType type)
static clang::CallingConv ConvertDWARFCallingConventionToClang(const ParsedDWARFTypeAttributes &attrs)
static bool IsSubroutine(const DWARFDIE &die)
static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die)
static DWARFDIE FindFirstChildWithAbstractOrigin(const DWARFDIE &block, const DWARFDIE &function)
static DWARFDIE FindAnyChildWithAbstractOrigin(const DWARFDIE &context)
static bool IsClangModuleFwdDecl(const DWARFDIE &Die)
Detect a forward declaration that is nested in a DW_TAG_module.
static DWARFDIE GetContainingClangModuleDIE(const DWARFDIE &die)
static DWARFDIE GetContainingFunctionWithAbstractOrigin(const DWARFDIE &die)
static void PrepareContextToReceiveMembers(TypeSystemClang &ast, ClangASTImporter &ast_importer, clang::DeclContext *decl_ctx, DWARFDIE die, const char *type_name_cstr)
This function serves a similar purpose as RequireCompleteType above, but it avoids completing the typ...
#define DEBUG_PRINTF(fmt,...)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
#define DIE_IS_BEING_PARSED
const char * m_property_getter_name
CompilerType m_class_opaque_type
std::unique_ptr< ClangASTMetadata > m_metadata_up
DelayedAddObjCClassProperty(const CompilerType &class_opaque_type, const char *property_name, const CompilerType &property_opaque_type, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, const ClangASTMetadata *metadata)
CompilerType m_property_opaque_type
const char * m_property_setter_name
uint32_t m_property_attributes
DelayedAddObjCClassProperty(const DelayedAddObjCClassProperty &rhs)
DelayedAddObjCClassProperty & operator=(const DelayedAddObjCClassProperty &rhs)
const char * m_property_name
bool CompleteRecordType(const DWARFDIE &die, lldb_private::Type *type, lldb_private::CompilerType &clang_type)
bool CompleteEnumType(const DWARFDIE &die, lldb_private::Type *type, lldb_private::CompilerType &clang_type)
lldb::TypeSP ParsePointerToMemberType(const DWARFDIE &die, const ParsedDWARFTypeAttributes &attrs)
bool ParseTemplateDIE(const DWARFDIE &die, lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos)
llvm::Expected< llvm::APInt > ExtractIntFromFormValue(const lldb_private::CompilerType &int_type, const DWARFFormValue &form_value) const
Extracts an value for a given Clang integer type from a DWARFFormValue.
std::unique_ptr< lldb_private::ClangASTImporter > m_clang_ast_importer_up
lldb::TypeSP ParseSubroutine(const DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
size_t ParseChildParameters(clang::DeclContext *containing_decl_ctx, const DWARFDIE &parent_die, bool skip_artificial, bool &is_static, bool &is_variadic, bool &has_template_params, std::vector< lldb_private::CompilerType > &function_args, std::vector< clang::ParmVarDecl * > &function_param_decls, unsigned &type_quals)
lldb_private::TypeSystemClang & m_ast
bool ShouldCreateUnnamedBitfield(FieldInfo const &last_field_info, uint64_t last_field_end, FieldInfo const &this_field_info, lldb_private::ClangASTImporter::LayoutInfo const &layout_info) const
Returns 'true' if we should create an unnamed bitfield and add it to the parser's current AST.
lldb_private::Function * ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit, const DWARFDIE &die, const lldb_private::AddressRange &func_range) override
lldb_private::ClangASTImporter & GetClangASTImporter()
clang::NamespaceDecl * ResolveNamespaceDIE(const DWARFDIE &die)
lldb_private::CompilerDeclContext GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override
void ParseObjCProperty(const DWARFDIE &die, const DWARFDIE &parent_die, const lldb_private::CompilerType &class_clang_type, DelayedPropertyList &delayed_properties)
Parses a DW_TAG_APPLE_property DIE and appends the parsed data to the list of delayed Objective-C pro...
lldb_private::CompilerDeclContext GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) override
DIEToDeclContextMap m_die_to_decl_ctx
lldb_private::Type * GetTypeForDIE(const DWARFDIE &die)
std::string GetCPlusPlusQualifiedName(const DWARFDIE &die)
void EnsureAllDIEsInDeclContextHaveBeenParsed(lldb_private::CompilerDeclContext decl_context) override
lldb::TypeSP ParseArrayType(const DWARFDIE &die, const ParsedDWARFTypeAttributes &attrs)
size_t ParseChildEnumerators(lldb_private::CompilerType &compiler_type, bool is_signed, uint32_t enumerator_byte_size, const DWARFDIE &parent_die)
clang::DeclContext * GetCachedClangDeclContextForDIE(const DWARFDIE &die)
clang::NamespaceDecl * ResolveImportedDeclarationDIE(const DWARFDIE &die)
Returns the namespace decl that a DW_TAG_imported_declaration imports.
DIEToDeclMap m_die_to_decl
bool CopyUniqueClassMethodTypes(const DWARFDIE &src_class_die, const DWARFDIE &dst_class_die, lldb_private::Type *class_type, std::vector< DWARFDIE > &failures)
lldb::TypeSP UpdateSymbolContextScopeForType(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb::TypeSP type_sp)
If type_sp is valid, calculate and set its symbol context scope, and update the type list for its bac...
lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die, bool *type_is_new_ptr) override
clang::DeclContext * GetClangDeclContextContainingDIE(const DWARFDIE &die, DWARFDIE *decl_ctx_die)
lldb::TypeSP ParseTypeModifier(const lldb_private::SymbolContext &sc, const DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
~DWARFASTParserClang() override
bool CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type, lldb_private::CompilerType &compiler_type) override
std::vector< DelayedAddObjCClassProperty > DelayedPropertyList
clang::BlockDecl * ResolveBlockDIE(const DWARFDIE &die)
lldb::TypeSP ParseStructureLikeDIE(const lldb_private::SymbolContext &sc, const DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
Parse a structure, class, or union type DIE.
lldb::TypeSP ParseEnum(const lldb_private::SymbolContext &sc, const DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
clang::DeclContext * GetDeclContextForBlock(const DWARFDIE &die)
lldb::TypeSP ParseTypeFromClangModule(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb_private::Log *log)
Follow Clang Module Skeleton CU references to find a type definition.
bool ParseChildMembers(const DWARFDIE &die, lldb_private::CompilerType &class_compiler_type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > &base_classes, std::vector< DWARFDIE > &member_function_dies, DelayedPropertyList &delayed_properties, const lldb::AccessType default_accessibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
DIEToModuleMap m_die_to_module
DeclContextToDIEMap m_decl_ctx_to_die
void ParseInheritance(const DWARFDIE &die, const DWARFDIE &parent_die, const lldb_private::CompilerType class_clang_type, const lldb::AccessType default_accessibility, const lldb::ModuleSP &module_sp, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > &base_classes, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
Parses a DW_TAG_inheritance DIE into a base/super class.
lldb_private::OptionalClangModuleID GetOwningClangModule(const DWARFDIE &die)
lldb_private::ConstString GetDIEClassTemplateParams(const DWARFDIE &die) override
Returns the template parameters of a class DWARFDIE as a string.
void LinkDeclContextToDIE(clang::DeclContext *decl_ctx, const DWARFDIE &die)
void ParseSingleMember(const DWARFDIE &die, const DWARFDIE &parent_die, const lldb_private::CompilerType &class_clang_type, lldb::AccessType default_accessibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info, FieldInfo &last_field_info)
DWARFASTParserClang(lldb_private::TypeSystemClang &ast)
lldb_private::ConstString ConstructDemangledNameFromDWARF(const DWARFDIE &die) override
bool ParseTemplateParameterInfos(const DWARFDIE &parent_die, lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos)
clang::DeclContext * GetClangDeclContextForDIE(const DWARFDIE &die)
clang::Decl * GetClangDeclForDIE(const DWARFDIE &die)
lldb_private::CompilerDecl GetDeclForUIDFromDWARF(const DWARFDIE &die) override
static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility)
static std::optional< lldb_private::SymbolFile::ArrayInfo > ParseChildArrayInfo(const DWARFDIE &parent_die, const lldb_private::ExecutionContext *exe_ctx=nullptr)
dw_attr_t AttributeAtIndex(uint32_t i) const
DWARFUnit * CompileUnitAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
const char * GetTagAsCString() const
const lldb_private::DWARFDataExtractor & GetData() const
const char * GetAttributeValueAsString(const dw_attr_t attr, const char *fail_value) const
DWARFUnit * GetCU() const
std::optional< DIERef > GetDIERef() const
SymbolFileDWARF * GetDWARF() const
bool Supports_DW_AT_APPLE_objc_complete_type() const
uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr, uint64_t fail_value) const
dw_offset_t GetOffset() const
lldb::user_id_t GetID() const
void GetName(lldb_private::Stream &s) const
DWARFDIE GetFirstChild() const
DWARFDIE GetParent() const
void GetDeclContext(llvm::SmallVectorImpl< lldb_private::CompilerContext > &context) const
Return this DIE's decl context as it is needed to look up types in Clang's -gmodules debug info forma...
const char * GetMangledName() const
DWARFDIE GetDIE(dw_offset_t die_offset) const
llvm::iterator_range< child_iterator > children() const
The range of all the children of this DIE.
DWARFDIE GetParentDeclContextDIE() const
lldb_private::Type * ResolveTypeUID(const DWARFDIE &die) const
DWARFDIE GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const
DWARFDIE GetReferencedDIE(const dw_attr_t attr) const
lldb_private::Type * ResolveType() const
bool GetDIENamesAndRanges(const char *&name, const char *&mangled, DWARFRangeList &ranges, std::optional< int > &decl_file, std::optional< int > &decl_line, std::optional< int > &decl_column, std::optional< int > &call_file, std::optional< int > &call_line, std::optional< int > &call_column, lldb_private::DWARFExpressionList *frame_base) const
const char * GetQualifiedName() const
SymbolFileDWARF & GetSymbolFileDWARF() const
bool Supports_unnamed_objc_bitfields()
lldb_private::FileSpec GetFile(size_t file_idx)
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, lldb_private::ConstString type_name, bool must_be_implementation)
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die)
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
lldb_private::Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb_private::Type * > DIEToTypePtr
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name)
bool ForEachExternalModule(lldb_private::CompileUnit &, llvm::DenseSet< lldb_private::SymbolFile * > &, llvm::function_ref< bool(lldb_private::Module &)>) override
static lldb_private::CompilerDecl GetDecl(const DWARFDIE &die)
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE &die)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
virtual DIEToTypePtr & GetDIEToType()
static lldb_private::CompilerDeclContext GetDeclContext(const DWARFDIE &die)
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool IsValid() const
Check if the object state is valid.
Block * FindBlockByID(lldb::user_id_t block_id)
Manages and observes all Clang AST node importing in LLDB.
CompilerType CopyType(TypeSystemClang &dst, const CompilerType &src_type)
Copies the given type and the respective declarations to the destination type system.
bool CanImport(const CompilerType &type)
Returns true iff the given type was copied from another TypeSystemClang and the original type in this...
void SetRecordLayout(clang::RecordDecl *decl, const LayoutInfo &layout)
Sets the layout for the given RecordDecl.
bool RequireCompleteType(clang::QualType type)
A class that describes a compilation unit.
void AddFunction(lldb::FunctionSP &function_sp)
Add a function to this compile unit.
Represents a generic declaration context in a program.
void * GetOpaqueDeclContext() const
Represents a generic declaration such as a function declaration.
void * GetOpaqueDecl() const
std::shared_ptr< TypeSystemType > dyn_cast_or_null()
Return a shared_ptr<TypeSystemType> if dyn_cast succeeds.
Generic representation of a type in a programming language.
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
bool IsCompleteType() const
lldb::opaque_compiler_type_t GetOpaqueQualType() const
bool IsBeingDefined() const
bool IsIntegerOrEnumerationType(bool &is_signed) const
ConstString GetTypeName(bool BaseOnly=false) const
bool IsIntegerType(bool &is_signed) const
bool GetCompleteType() const
Type Completion.
std::optional< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
A uniqued constant string class.
void SetCString(const char *cstr)
Set the C string value.
void SetString(const llvm::StringRef &s)
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
bool IsValid() const
Return true if the location expression contains data.
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::ModuleSP module_sp, const DataExtractor &opcodes, const DWARFUnit *dwarf_cu, const lldb::RegisterKind reg_set, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr)
Evaluate a DWARF location expression in a particular context.
A class that describes the declaration location of a lldb object.
void SetLine(uint32_t line)
Set accessor for the declaration line number.
void SetColumn(uint16_t column)
Set accessor for the declaration column number.
void Clear()
Clear the object's state.
void SetFile(const FileSpec &file_spec)
Set accessor for the declaration file specification.
A class that describes a function.
Block & GetBlock(bool can_create)
Get accessor for the block list.
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
static bool LanguageIsObjC(lldb::LanguageType language)
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
A class that describes an executable image and its associated object and symbol files.
static std::optional< const MethodName > Create(llvm::StringRef name, bool strict)
The static factory method for creating a MethodName.
A plug-in interface definition class for object file parsers.
virtual lldb::ByteOrder GetByteOrder() const =0
Gets whether endian swapping should occur when extracting data from this object file.
unsigned int UInt(unsigned int fail_value=0) const
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
ObjectFile * GetObjectFile() override
lldb::TypeSP GetTypeAtIndex(uint32_t idx)
The implementation of lldb::Type's m_payload field for TypeSystemClang.
void SetPackName(char const *name)
void SetParameterPack(std::unique_ptr< TemplateParameterInfos > args)
void InsertArg(char const *name, clang::TemplateArgument arg)
bool hasParameterPack() const
TemplateParameterInfos const & GetParameterPack() const
A TypeSystem implementation based on Clang.
clang::TranslationUnitDecl * GetTranslationUnitDecl()
void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data)
CompilerType GetBasicType(lldb::BasicType type)
clang::UsingDecl * CreateUsingDeclaration(clang::DeclContext *current_decl_ctx, OptionalClangModuleID owning_module, clang::NamedDecl *target)
OptionalClangModuleID GetOrCreateClangModule(llvm::StringRef name, OptionalClangModuleID parent, bool is_framework=false, bool is_explicit=false)
Synthesize a clang::Module and return its ID or a default-constructed ID.
static clang::FieldDecl * AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, lldb::AccessType access, uint32_t bitfield_bit_size)
CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override
clang::FunctionTemplateDecl * CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::FunctionDecl *func_decl, const TemplateParameterInfos &infos)
bool SetDeclIsForcefullyCompleted(const clang::TagDecl *td)
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
static bool IsCXXClassType(const CompilerType &type)
static bool AddObjCClassProperty(const CompilerType &type, const char *property_name, const CompilerType &property_compiler_type, clang::ObjCIvarDecl *ivar_decl, const char *property_setter_name, const char *property_getter_name, uint32_t property_attributes, ClangASTMetadata *metadata)
CompilerType GetType(clang::QualType qt)
Creates a CompilerType from the given QualType with the current TypeSystemClang instance as the Compi...
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
bool TransferBaseClasses(lldb::opaque_compiler_type_t type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > bases)
static void SetIntegerInitializerForVariable(clang::VarDecl *var, const llvm::APInt &init_value)
Initializes a variable with an integer value.
CompilerType CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *class_template_specialization_decl)
void CreateFunctionTemplateSpecializationInfo(clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template, const TemplateParameterInfos &infos)
CompilerDecl GetCompilerDecl(clang::Decl *decl)
Creates a CompilerDecl from the given Decl with the current TypeSystemClang instance as its typesyste...
CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type) override
std::string PrintTemplateParams(const TemplateParameterInfos &template_param_infos)
Return the template parameters (including surrounding <>) in string form.
CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx)
Creates a CompilerDeclContext from the given DeclContext with the current TypeSystemClang instance as...
void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id)
static clang::RecordDecl * GetAsRecordDecl(const CompilerType &type)
clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, llvm::StringRef name, const CompilerType &function_Type, clang::StorageClass storage, bool is_inline)
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name, uint32_t dw_ate, uint32_t bit_size)
static void BuildIndirectFields(const CompilerType &type)
void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type)
CompilerType CreateBlockPointerType(const CompilerType &function_type)
clang::ClassTemplateSpecializationDecl * CreateClassTemplateSpecializationDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::ClassTemplateDecl *class_template_decl, int kind, const TemplateParameterInfos &infos)
clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, llvm::StringRef name, const char *mangled_name, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, bool is_attr_used, bool is_artificial)
clang::EnumConstantDecl * AddEnumerationValueToEnumerationType(const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size)
clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, bool is_inline=false)
static clang::CXXRecordDecl * GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type)
clang::UsingDirectiveDecl * CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, clang::NamespaceDecl *ns_decl)
clang::ASTContext & getASTContext()
Returns the clang::ASTContext instance managed by this TypeSystemClang.
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, lldb::AccessType access, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
CompilerType CreateEnumerationType(llvm::StringRef name, clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped)
clang::ParmVarDecl * CreateParameterDeclaration(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, const char *name, const CompilerType ¶m_type, int storage, bool add_decl=false)
static clang::NamespaceDecl * DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc)
CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector)
CompilerType GetTypeForDecl(clang::NamedDecl *decl)
static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc)
static bool StartTagDeclarationDefinition(const CompilerType &type)
static clang::VarDecl * AddVariableToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &var_type, lldb::AccessType access)
CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, bool is_variadic, unsigned type_quals, clang::CallingConv cc=clang::CC_C, clang::RefQualifierKind ref_qual=clang::RQ_None)
void SetFunctionParameters(clang::FunctionDecl *function_decl, llvm::ArrayRef< clang::ParmVarDecl * > params)
static bool IsObjCObjectOrInterfaceType(const CompilerType &type)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, ClangASTMetadata *metadata=nullptr, bool exports_symbols=false)
static void RequireCompleteType(CompilerType type)
Complete a type from debug info, or mark it as forcefully completed if there is no definition of the ...
clang::TemplateTemplateParmDecl * CreateTemplateTemplateParmDecl(const char *template_name)
clang::ClassTemplateDecl * ParseClassTemplateDecl(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, const char *parent_name, int tag_decl_kind, const TypeSystemClang::TemplateParameterInfos &template_param_infos)
static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type)
clang::VarDecl * CreateVariableDeclaration(clang::DeclContext *decl_context, OptionalClangModuleID owning_module, const char *name, clang::QualType type)
clang::BlockDecl * CreateBlockDeclaration(clang::DeclContext *ctx, OptionalClangModuleID owning_module)
CompilerType GetForwardCompilerType()
uint32_t GetEncodingMask()
@ eEncodingIsRestrictUID
This type is the type whose UID is m_encoding_uid with the restrict qualifier added.
@ eEncodingIsConstUID
This type is the type whose UID is m_encoding_uid with the const qualifier added.
@ eEncodingIsVolatileUID
This type is the type whose UID is m_encoding_uid with the volatile qualifier added.
@ eEncodingIsAtomicUID
This type is the type whose UID is m_encoding_uid as an atomic type.
@ eEncodingInvalid
Invalid encoding.
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
@ eEncodingIsPointerUID
This type is pointer to a type whose UID is m_encoding_uid.
@ eEncodingIsLValueReferenceUID
This type is L value reference to a type whose UID is m_encoding_uid.
@ eEncodingIsRValueReferenceUID
This type is R value reference to a type whose UID is m_encoding_uid.
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
CompilerType GetLayoutCompilerType()
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
CompilerType GetFullCompilerType()
ConstString GetCStringAtIndex(uint32_t idx) const
T GetValueAtIndexUnchecked(uint32_t idx) const
T Find(ConstString unique_cstr, T fail_value) const
Scalar & ResolveValue(ExecutionContext *exe_ctx)
llvm::dwarf::Tag dw_tag_t
llvm::dwarf::Attribute dw_attr_t
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
const char * DW_TAG_value_to_name(uint32_t val)
LanguageType
Programming language type.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeObjC
Objective-C.
@ eEncodingSint
signed integer
@ eRegisterKindDWARF
the register numbers seen DWARF
void SetIsArtificial(bool flag)
bool IsArtificial() const
bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const
void SetIsBitfield(bool flag)
Parsed form of all attributes that are relevant for type reconstruction.
lldb_private::Declaration decl
const char * mangled_name
lldb_private::ConstString name
lldb::AccessType accessibility
bool is_complete_objc_class
lldb::LanguageType class_language
bool is_forward_declaration
std::optional< uint64_t > byte_size
ParsedDWARFTypeAttributes(const DWARFDIE &die)
clang::StorageClass storage
DWARFFormValue specification
clang::RefQualifierKind ref_qual
Indicates ref-qualifier of C++ member function if present.
DWARFFormValue containing_type
DWARFFormValue abstract_origin
size_t calling_convention
llvm::DenseMap< const clang::FieldDecl *, uint64_t > field_offsets
static clang::QualType GetQualType(const CompilerType &ct)
static CompilerType RemoveFastQualifiers(const CompilerType &ct)
static clang::TagDecl * GetAsTagDecl(const CompilerType &type)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
void Insert(lldb::LanguageType language)
lldb::user_id_t GetID() const
Get accessor for the user ID.