40#include "clang/AST/CXXInheritance.h"
41#include "clang/AST/DeclBase.h"
42#include "clang/AST/DeclCXX.h"
43#include "clang/AST/DeclObjC.h"
44#include "clang/AST/DeclTemplate.h"
45#include "clang/AST/Type.h"
46#include "clang/Basic/Specifiers.h"
47#include "llvm/ADT/StringExtras.h"
48#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
49#include "llvm/DebugInfo/DWARF/DWARFTypePrinter.h"
50#include "llvm/Demangle/Demangle.h"
59#ifdef ENABLE_DEBUG_PRINTF
61#define DEBUG_PRINTF(fmt, ...) printf(fmt, __VA_ARGS__)
63#define DEBUG_PRINTF(fmt, ...)
73 m_die_to_decl_ctx(), m_decl_ctx_to_die() {}
79 case clang::Decl::CXXRecord:
80 case clang::Decl::ClassTemplateSpecialization:
101 while (Parent.IsValid()) {
102 if (Parent.Tag() == DW_TAG_module)
115 parent = parent.GetParent()) {
117 if (tag == DW_TAG_module)
118 top_module_die = parent;
119 else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
123 return top_module_die;
132 if (clang_module_die) {
133 const char *module_name = clang_module_die.
GetName();
145 return FieldName.starts_with(
"_vptr$")
147 || FieldName.starts_with(
"_vptr.");
153 case DW_TAG_class_type:
154 case DW_TAG_structure_type:
155 case DW_TAG_union_type:
166 if (!clang_module_sp)
172 std::vector<lldb_private::CompilerContext> die_context = die.
GetDeclContext();
173 TypeQuery query(die_context, TypeQueryOptions::e_module_search |
174 TypeQueryOptions::e_find_one);
179 clang_module_sp->FindTypes(query, results);
191 sym_file.ForEachExternalModule(
193 module.FindTypes(query, results);
194 pcm_type_sp = results.GetTypeMap().FirstType();
195 return (bool)pcm_type_sp;
225 auto type_sp =
dwarf->MakeType(
226 die.
GetID(), pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(
nullptr),
228 &pcm_type_sp->GetDeclaration(), type, Type::ResolveState::Forward,
248 clang::DeclContext *decl_ctx,
250 const char *type_name_cstr) {
251 auto *tag_decl_ctx = clang::dyn_cast<clang::TagDecl>(decl_ctx);
256 if (tag_decl_ctx->isCompleteDefinition() || tag_decl_ctx->isBeingDefined())
264 if (type && ast_importer.
CanImport(type)) {
269 "Unable to complete the Decl context for DIE {0} at offset "
270 "{1:x16}.\nPlease file a bug report.",
271 type_name_cstr ? type_name_cstr :
"", die.
GetOffset());
280 if (!tag_decl_ctx->hasExternalLexicalStorage()) {
288 for (
size_t i = 0; i < attributes.
Size(); ++i) {
296 case DW_AT_abstract_origin:
300 case DW_AT_accessibility:
305 case DW_AT_artificial:
309 case DW_AT_bit_stride:
313 case DW_AT_byte_size:
317 case DW_AT_alignment:
321 case DW_AT_byte_stride:
325 case DW_AT_calling_convention:
329 case DW_AT_containing_type:
333 case DW_AT_decl_file:
338 case DW_AT_decl_line:
341 case DW_AT_decl_column:
345 case DW_AT_declaration:
353 case DW_AT_enum_class:
370 case DW_AT_linkage_name:
371 case DW_AT_MIPS_linkage_name:
379 case DW_AT_object_pointer:
383 case DW_AT_signature:
387 case DW_AT_specification:
395 case DW_AT_virtuality:
399 case DW_AT_APPLE_objc_complete_type:
403 case DW_AT_APPLE_objc_direct:
407 case DW_AT_APPLE_runtime_class:
411 case DW_AT_GNU_vector:
414 case DW_AT_export_symbols:
417 case DW_AT_rvalue_reference:
420 case DW_AT_reference:
429 return unit->GetAbsolutePath().GetPath();
430 return "<missing DWARF unit path>";
435 bool *type_is_new_ptr) {
437 *type_is_new_ptr =
false;
442 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
447 clang::DeclContext *context =
450 dwarf->GetObjectFile()->GetModule()->LogMessage(
452 "DWARFASTParserClang::ParseTypeFromDWARF "
453 "(die = {0:x16}, decl_ctx = {1:p} (die "
454 "{2:x16})) {3} ({4}) name = '{5}')",
460 if (
auto [it, inserted] =
465 return it->getSecond()->shared_from_this();
474 if (clang::DeclContext *decl_ctx =
480 *type_is_new_ptr =
true;
486 case DW_TAG_base_type:
487 case DW_TAG_pointer_type:
488 case DW_TAG_reference_type:
489 case DW_TAG_rvalue_reference_type:
490 case DW_TAG_const_type:
491 case DW_TAG_restrict_type:
492 case DW_TAG_volatile_type:
493 case DW_TAG_LLVM_ptrauth_type:
494 case DW_TAG_atomic_type:
495 case DW_TAG_unspecified_type:
498 case DW_TAG_structure_type:
499 case DW_TAG_union_type:
500 case DW_TAG_class_type:
503 case DW_TAG_enumeration_type:
506 case DW_TAG_inlined_subroutine:
507 case DW_TAG_subprogram:
508 case DW_TAG_subroutine_type:
511 case DW_TAG_array_type:
514 case DW_TAG_ptr_to_member_type:
518 dwarf->GetObjectFile()->GetModule()->ReportError(
519 "[{0:x16}]: unhandled type tag {1:x4} ({2}), "
520 "please file a bug and "
521 "attach the file at the start of this error message",
528 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
533static std::optional<uint32_t>
536 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
544 Value initialValue(0);
546 uint32_t block_length = form_value.
Unsigned();
547 uint32_t block_offset =
557 "ExtractDataMemberLocation failed: {0}");
561 return memberOffset->ResolveValue(
nullptr).UInt();
565 auto getAttr = [&](llvm::dwarf::Attribute Attr,
unsigned defaultValue = 0) {
568 const unsigned key = getAttr(DW_AT_LLVM_ptrauth_key);
569 const bool addr_disc = getAttr(DW_AT_LLVM_ptrauth_address_discriminated);
570 const unsigned extra = getAttr(DW_AT_LLVM_ptrauth_extra_discriminator);
571 const bool isapointer = getAttr(DW_AT_LLVM_ptrauth_isa_pointer);
572 const bool authenticates_null_values =
573 getAttr(DW_AT_LLVM_ptrauth_authenticates_null_values);
574 const unsigned authentication_mode_int = getAttr(
575 DW_AT_LLVM_ptrauth_authentication_mode,
576 static_cast<unsigned>(clang::PointerAuthenticationMode::SignAndAuth));
577 clang::PointerAuthenticationMode authentication_mode =
578 clang::PointerAuthenticationMode::SignAndAuth;
579 if (authentication_mode_int >=
580 static_cast<unsigned>(clang::PointerAuthenticationMode::None) &&
581 authentication_mode_int <=
582 static_cast<unsigned>(
583 clang::PointerAuthenticationMode::SignAndAuth)) {
584 authentication_mode =
585 static_cast<clang::PointerAuthenticationMode
>(authentication_mode_int);
588 "[{0:x16}]: invalid pointer authentication mode method {1:x4}",
589 die.
GetOffset(), authentication_mode_int);
591 auto ptr_auth = clang::PointerAuthQualifier::Create(
592 key, addr_disc, extra, authentication_mode, isapointer,
593 authenticates_null_values);
601 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
611 if (tag == DW_TAG_typedef) {
661 encoding_uid.Reference());
667 case DW_TAG_unspecified_type:
668 if (attrs.
name ==
"nullptr_t" || attrs.
name ==
"decltype(nullptr)") {
669 resolve_state = Type::ResolveState::Full;
677 case DW_TAG_base_type:
678 resolve_state = Type::ResolveState::Full;
684 case DW_TAG_pointer_type:
687 case DW_TAG_reference_type:
690 case DW_TAG_rvalue_reference_type:
696 case DW_TAG_const_type:
699 case DW_TAG_restrict_type:
702 case DW_TAG_volatile_type:
705 case DW_TAG_LLVM_ptrauth_type:
709 case DW_TAG_atomic_type:
716 if (tag == DW_TAG_pointer_type) {
724 if (!strcmp(child_die.GetAttributeValueAsString(DW_AT_name,
""),
729 if (function_pointer_type) {
733 bool function_type_is_new_pointer;
735 sc, function_type, &function_type_is_new_pointer);
737 if (lldb_function_type_sp) {
739 lldb_function_type_sp->GetForwardCompilerType());
742 resolve_state = Type::ResolveState::Full;
755 if (attrs.
name ==
"id") {
757 dwarf->GetObjectFile()->GetModule()->LogMessage(
759 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} ({2}) '{3}' "
760 "is Objective-C 'id' built-in type.",
766 resolve_state = Type::ResolveState::Full;
767 }
else if (attrs.
name ==
"Class") {
769 dwarf->GetObjectFile()->GetModule()->LogMessage(
771 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} ({2}) '{3}' "
772 "is Objective-C 'Class' built-in type.",
778 resolve_state = Type::ResolveState::Full;
779 }
else if (attrs.
name ==
"SEL") {
781 dwarf->GetObjectFile()->GetModule()->LogMessage(
783 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} ({2}) '{3}' "
784 "is Objective-C 'selector' built-in type.",
790 resolve_state = Type::ResolveState::Full;
799 if (encoding_die && encoding_die.
Tag() == DW_TAG_structure_type) {
800 llvm::StringRef struct_name = encoding_die.
GetName();
801 if (struct_name ==
"objc_object") {
803 dwarf->GetObjectFile()->GetModule()->LogMessage(
805 "SymbolFileDWARF::ParseType (die = {0:x16}) {1} ({2}) '{3}' "
806 "is 'objc_object*', which we overrode to 'id'.",
812 resolve_state = Type::ResolveState::Full;
821 &attrs.
decl, clang_type, resolve_state, payload);
828 if (llvm::StringRef(die.
GetName()).contains(
"<"))
832 llvm::raw_string_ostream os(name);
833 llvm::DWARFTypePrinter<DWARFDIE> type_printer(os);
834 type_printer.appendAndTerminateTemplateParameters(die);
849 unique_typename, decl_declaration);
851 dwarf->GetUniqueDWARFASTTypeMap().Find(
852 unique_typename, decl_die, decl_declaration,
855 unique_ast_entry_type->UpdateToDefDIE(def_die, def_attrs.
decl,
857 }
else if (
Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups)) {
860 "Failed to find {0:x16} {1} ({2}) type \"{3}\" in "
861 "UniqueDWARFASTTypeMap",
869 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
878 def_die =
dwarf->FindDefinitionDIE(decl_die);
882 if (debug_map_symfile) {
890 dwarf->GetObjectFile()->GetModule()->LogMessage(
892 "SymbolFileDWARF({0:p}) - {1:x16}}: {2} ({3}) type \"{4}\" is a "
893 "forward declaration, complete DIE is {5}",
896 def_die ? llvm::utohexstr(def_die.
GetID()) :
"not found");
900 if (
auto [it, inserted] =
dwarf->GetDIEToType().try_emplace(
905 return it->getSecond()->shared_from_this();
916 Type *enumerator_type =
922 if (!enumerator_clang_type) {
925 "", DW_ATE_signed, *attrs.
byte_size * 8);
938 &attrs.
decl, clang_type, Type::ResolveState::Forward,
941 clang::DeclContext *type_decl_ctx =
944 if (decl_die != def_die) {
946 dwarf->GetDIEToType()[def_die.
GetDIE()] = type_sp.get();
953 bool is_signed =
false;
956 type_sp->
GetByteSize(
nullptr).value_or(0), def_die);
960 dwarf->GetObjectFile()->GetModule()->ReportError(
961 "DWARF DIE at {0:x16} named \"{1}\" was not able to start its "
962 "definition.\nPlease file a bug and attach the file at the "
963 "start of this error message",
969static clang::CallingConv
972 case llvm::dwarf::DW_CC_normal:
974 case llvm::dwarf::DW_CC_BORLAND_stdcall:
975 return clang::CC_X86StdCall;
976 case llvm::dwarf::DW_CC_BORLAND_msfastcall:
977 return clang::CC_X86FastCall;
978 case llvm::dwarf::DW_CC_LLVM_vectorcall:
979 return clang::CC_X86VectorCall;
980 case llvm::dwarf::DW_CC_BORLAND_pascal:
981 return clang::CC_X86Pascal;
982 case llvm::dwarf::DW_CC_LLVM_Win64:
983 return clang::CC_Win64;
984 case llvm::dwarf::DW_CC_LLVM_X86_64SysV:
985 return clang::CC_X86_64SysV;
986 case llvm::dwarf::DW_CC_LLVM_X86RegCall:
987 return clang::CC_X86RegCall;
992 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
993 LLDB_LOG(log,
"Unsupported DW_AT_calling_convention value: {0}",
1006 const auto tag = die.
Tag();
1011 TypeSP complete_objc_class_type_sp =
1012 dwarf->FindCompleteObjCDefinitionTypeForDIE(
DWARFDIE(), class_name,
1015 if (!complete_objc_class_type_sp)
1019 complete_objc_class_type_sp->GetForwardCompilerType();
1021 if (!type_clang_forward_type)
1031 if (!objc_method_decl) {
1032 dwarf->GetObjectFile()->GetModule()->ReportError(
1033 "[{0:x16}]: invalid Objective-C method {1:x4} ({2}), "
1034 "please file a bug and attach the file at the start of "
1035 "this error message",
1049 bool is_static,
bool &ignore_containing_context) {
1050 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
1054 Type *class_type =
dwarf->ResolveType(decl_ctx_die);
1058 if (class_type->
GetID() != decl_ctx_die.
GetID() ||
1065 std::vector<DWARFDIE> failures;
1077 return {
true, type_ptr->shared_from_this()};
1091 clang::DeclContext *spec_clang_decl_ctx =
1093 if (spec_clang_decl_ctx)
1096 dwarf->GetObjectFile()->GetModule()->ReportWarning(
1097 "{0:x8}: DW_AT_specification({1:x16}"
1101 return {
true,
nullptr};
1113 if (abs_clang_decl_ctx)
1116 dwarf->GetObjectFile()->GetModule()->ReportWarning(
1117 "{0:x8}: DW_AT_abstract_origin({1:x16}"
1121 return {
true,
nullptr};
1137 return {
true,
nullptr};
1139 const bool is_attr_used =
false;
1143 const auto accessibility =
1152 if (cxx_method_decl) {
1158 char const *object_pointer_name =
1160 if (object_pointer_name) {
1162 LLDB_LOGF(log,
"Setting object pointer name: %s on method object %p.\n",
1163 object_pointer_name,
static_cast<void *
>(cxx_method_decl));
1167 ignore_containing_context =
true;
1172 const bool type_handled = cxx_method_decl !=
nullptr || attrs.
is_artificial;
1174 return {type_handled,
nullptr};
1180 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
1185 bool is_variadic =
false;
1186 bool is_static =
false;
1187 bool has_template_params =
false;
1189 unsigned type_quals = 0;
1195 Type *func_type =
nullptr;
1205 std::vector<CompilerType> function_param_types;
1206 std::vector<clang::ParmVarDecl *> function_param_decls;
1211 clang::DeclContext *containing_decl_ctx =
1213 const clang::Decl::Kind containing_decl_kind =
1214 containing_decl_ctx->getDeclKind();
1220 if (is_cxx_method) {
1225 bool skip_artificial =
true;
1227 is_variadic, has_template_params,
1228 function_param_types, function_param_decls,
1232 bool ignore_containing_context =
false;
1243 if (is_cxx_method && has_template_params) {
1244 ignore_containing_context =
true;
1245 is_cxx_method =
false;
1248 clang::CallingConv calling_convention =
1255 function_param_types.size(), is_variadic,
1256 type_quals, calling_convention, attrs.
ref_qual);
1259 bool type_handled =
false;
1260 if (tag == DW_TAG_subprogram || tag == DW_TAG_inlined_subroutine) {
1261 if (std::optional<const ObjCLanguage::MethodName> objc_method =
1266 }
else if (is_cxx_method) {
1267 auto [handled, type_sp] =
1269 ignore_containing_context);
1273 type_handled = handled;
1277 if (!type_handled) {
1278 clang::FunctionDecl *function_decl =
nullptr;
1279 clang::FunctionDecl *template_function_decl =
nullptr;
1284 if (
dwarf->ResolveType(abs_die)) {
1285 function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>(
1288 if (function_decl) {
1294 if (!function_decl) {
1295 char *name_buf =
nullptr;
1302 llvm::ItaniumPartialDemangler D;
1304 name_buf = D.getFunctionBaseName(
nullptr,
nullptr);
1312 : containing_decl_ctx,
1315 std::free(name_buf);
1317 if (has_template_params) {
1322 : containing_decl_ctx,
1325 clang::FunctionTemplateDecl *func_template_decl =
1328 template_function_decl, template_param_infos);
1330 template_function_decl, func_template_decl, template_param_infos);
1335 if (function_decl) {
1347 function_decl->addAttr(clang::AsmLabelAttr::CreateImplicit(
1352 if (!function_param_decls.empty()) {
1354 if (template_function_decl)
1356 function_param_decls);
1362 char const *object_pointer_name =
1364 if (object_pointer_name) {
1367 "Setting object pointer name: %s on function "
1369 object_pointer_name,
static_cast<void *
>(function_decl));
1376 return dwarf->MakeType(
1390 Type *element_type =
dwarf->ResolveTypeUID(type_die,
true);
1399 byte_stride = array_info->byte_stride;
1400 bit_stride = array_info->bit_stride;
1402 if (byte_stride == 0 && bit_stride == 0)
1403 byte_stride = element_type->
GetByteSize(
nullptr).value_or(0);
1407 uint64_t array_element_bit_stride = byte_stride * 8 + bit_stride;
1409 if (array_info && array_info->element_orders.size() > 0) {
1410 auto end = array_info->element_orders.rend();
1411 for (
auto pos = array_info->element_orders.rbegin(); pos != end; ++pos) {
1413 array_element_type, *pos, attrs.
is_vector);
1415 uint64_t num_elements = pos->value_or(0);
1416 array_element_type = clang_type;
1417 array_element_bit_stride = num_elements
1418 ? array_element_bit_stride * num_elements
1419 : array_element_bit_stride;
1423 array_element_type, std::nullopt, attrs.
is_vector);
1427 dwarf->MakeType(die.
GetID(), empty_name, array_element_bit_stride / 8,
1429 &attrs.
decl, clang_type, Type::ResolveState::Full);
1430 type_sp->SetEncodingType(element_type);
1445 if ((class_type ==
nullptr) || (pointee_type ==
nullptr))
1452 class_clang_type, pointee_clang_type);
1454 if (std::optional<uint64_t> clang_type_size =
1456 return dwarf->MakeType(die.
GetID(), attrs.
name, *clang_type_size,
nullptr,
1458 clang_type, Type::ResolveState::Forward);
1467 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
1476 if (attributes.
Size() == 0)
1480 AccessType accessibility = default_accessibility;
1481 bool is_virtual =
false;
1482 bool is_base_of_class =
true;
1483 off_t member_byte_offset = 0;
1485 for (uint32_t i = 0; i < attributes.
Size(); ++i) {
1491 encoding_form = form_value;
1493 case DW_AT_data_member_location:
1494 if (
auto maybe_offset =
1496 member_byte_offset = *maybe_offset;
1499 case DW_AT_accessibility:
1504 case DW_AT_virtuality:
1505 is_virtual = form_value.
Boolean();
1515 if (base_class_type ==
nullptr) {
1516 module_sp->ReportError(
"{0:x16}: DW_TAG_inheritance failed to "
1517 "resolve the base class at {1:x16}"
1518 " from enclosing type {2:x16}. \nPlease file "
1519 "a bug and attach the file at the start of "
1520 "this error message",
1528 assert(base_class_clang_type);
1530 ast->SetObjCSuperClass(class_clang_type, base_class_clang_type);
1533 std::unique_ptr<clang::CXXBaseSpecifier> result =
1535 accessibility, is_virtual,
1540 base_classes.push_back(std::move(result));
1558 clang::CharUnits::fromQuantity(member_byte_offset)));
1571 if (sc_parent_tag == DW_TAG_compile_unit ||
1572 sc_parent_tag == DW_TAG_partial_unit) {
1574 }
else if (sc.
function !=
nullptr && sc_parent_die) {
1575 symbol_context_scope =
1577 if (symbol_context_scope ==
nullptr)
1578 symbol_context_scope = sc.
function;
1580 symbol_context_scope = sc.
module_sp.get();
1583 if (symbol_context_scope !=
nullptr)
1584 type_sp->SetSymbolContextScope(symbol_context_scope);
1598 decl_declaration.
Clear();
1599 std::string qualified_name;
1602 while (parent_decl_ctx_die) {
1606 const dw_tag_t parent_tag = parent_decl_ctx_die.
Tag();
1607 switch (parent_tag) {
1608 case DW_TAG_namespace: {
1609 if (
const char *namespace_name = parent_decl_ctx_die.
GetName()) {
1610 qualified_name.insert(0,
"::");
1611 qualified_name.insert(0, namespace_name);
1613 qualified_name.insert(0,
"(anonymous namespace)::");
1619 case DW_TAG_class_type:
1620 case DW_TAG_structure_type:
1621 case DW_TAG_union_type: {
1622 if (
const char *class_union_struct_name = parent_decl_ctx_die.
GetName()) {
1623 qualified_name.insert(0,
"::");
1624 qualified_name.insert(0,
1626 qualified_name.insert(0, class_union_struct_name);
1633 parent_decl_ctx_die.
Clear();
1638 if (qualified_name.empty())
1639 qualified_name.append(
"::");
1641 qualified_name.append(unique_typename.
GetCString());
1655 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
1659 uint64_t byte_size = attrs.
byte_size.value_or(0);
1665 dwarf->GetObjectFile()->GetModule()->LogMessage(
1666 log,
"SymbolFileDWARF({0:p}) - {1:x16}: {2} has unique name: {3} ",
1671 dwarf->GetUniqueDWARFASTTypeMap().Find(
1672 unique_typename, die, unique_decl, byte_size,
1674 if (
TypeSP type_sp = unique_ast_entry_type->m_type_sp) {
1675 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
1682 unique_ast_entry_type->m_is_forward_declaration) {
1683 unique_ast_entry_type->UpdateToDefDIE(die, unique_decl, byte_size);
1684 clang_type = type_sp->GetForwardCompilerType();
1688 dwarf->GetForwardDeclCompilerTypeToDIE().insert_or_assign(
1700 int tag_decl_kind = -1;
1702 if (tag == DW_TAG_structure_type) {
1703 tag_decl_kind = llvm::to_underlying(clang::TagTypeKind::Struct);
1705 }
else if (tag == DW_TAG_union_type) {
1706 tag_decl_kind = llvm::to_underlying(clang::TagTypeKind::Union);
1708 }
else if (tag == DW_TAG_class_type) {
1709 tag_decl_kind = llvm::to_underlying(clang::TagTypeKind::Class);
1722 dwarf->FindCompleteObjCDefinitionTypeForDIE(die, attrs.
name,
true);
1726 if (debug_map_symfile) {
1730 die, attrs.
name,
true);
1736 dwarf->GetObjectFile()->GetModule()->LogMessage(
1738 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" is an "
1739 "incomplete objc type, complete type is {5:x8}",
1755 assert(tag_decl_kind != -1);
1757 clang::DeclContext *containing_decl_ctx =
1761 containing_decl_ctx, die,
1767 const clang::Decl::Kind containing_decl_kind =
1768 containing_decl_ctx->getDeclKind();
1779 clang::ClassTemplateDecl *class_template_decl =
1783 if (!class_template_decl) {
1785 dwarf->GetObjectFile()->GetModule()->LogMessage(
1787 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" "
1788 "clang::ClassTemplateDecl failed to return a decl.",
1795 clang::ClassTemplateSpecializationDecl *class_specialization_decl =
1798 tag_decl_kind, template_param_infos);
1816 Type::ResolveState::Forward,
1822 clang::DeclContext *type_decl_ctx =
1830 auto unique_ast_entry_up = std::make_unique<UniqueDWARFASTType>();
1834 unique_ast_entry_up->m_type_sp = type_sp;
1835 unique_ast_entry_up->m_die = die;
1836 unique_ast_entry_up->m_declaration = unique_decl;
1837 unique_ast_entry_up->m_byte_size = byte_size;
1839 dwarf->GetUniqueDWARFASTTypeMap().Insert(unique_typename,
1840 *unique_ast_entry_up);
1848 dwarf->GetForwardDeclCompilerTypeToDIE()
1853 assert(inserted &&
"Type already in the forward declaration map!");
1862 clang::CXXRecordDecl *record_decl =
1864 if (record_decl && record_decl->getDefinition()) {
1865 record_decl->setHasTrivialSpecialMemberForCall();
1870 clang::CXXRecordDecl *record_decl =
1873 record_decl->setArgPassingRestrictions(
1874 clang::RecordArgPassingKind::CannotPassInRegs);
1884 const CompilerType &class_opaque_type,
const char *property_name,
1888 const char *property_setter_name,
const char *property_getter_name,
1917 bool is_template_template_argument =
false;
1920 case DW_TAG_GNU_template_parameter_pack: {
1922 std::make_unique<TypeSystemClang::TemplateParameterInfos>());
1927 if (
const char *name = die.
GetName()) {
1932 case DW_TAG_GNU_template_template_param:
1933 is_template_template_argument =
true;
1935 case DW_TAG_template_type_parameter:
1936 case DW_TAG_template_value_parameter: {
1938 if (attributes.
Size() == 0)
1941 const char *name =
nullptr;
1942 const char *template_name =
nullptr;
1944 uint64_t uval64 = 0;
1945 bool uval64_valid =
false;
1946 bool is_default_template_arg =
false;
1948 for (
size_t i = 0; i < attributes.
Size(); ++i) {
1957 case DW_AT_GNU_template_name:
1970 case DW_AT_const_value:
1972 uval64_valid =
true;
1976 case DW_AT_default_value:
1978 is_default_template_arg = form_value.
Boolean();
1989 if (!is_template_template_argument) {
1990 bool is_signed =
false;
1994 if (name && !name[0])
1997 if (tag == DW_TAG_template_value_parameter && uval64_valid) {
1998 std::optional<uint64_t> size = clang_type.
GetBitSize(
nullptr);
2001 llvm::APInt apint(*size, uval64, is_signed);
2003 name, clang::TemplateArgument(ast, llvm::APSInt(apint, !is_signed),
2005 is_default_template_arg));
2010 is_default_template_arg));
2015 name, clang::TemplateArgument(clang::TemplateName(tplt_type),
2016 is_default_template_arg));
2038 case DW_TAG_template_type_parameter:
2039 case DW_TAG_template_value_parameter:
2040 case DW_TAG_GNU_template_parameter_pack:
2041 case DW_TAG_GNU_template_template_param:
2050 return !template_param_infos.
IsEmpty() ||
2061 std::vector<DWARFDIE> contained_type_dies;
2073 if (tag == DW_TAG_structure_type) {
2075 }
else if (tag == DW_TAG_union_type) {
2077 }
else if (tag == DW_TAG_class_type) {
2081 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> bases;
2083 std::vector<DWARFDIE> member_function_dies;
2087 contained_type_dies, delayed_properties,
2088 default_accessibility, layout_info);
2091 for (
const DWARFDIE &die : member_function_dies)
2092 dwarf->ResolveType(die);
2097 dwarf->GetObjCMethods(class_name, [&](
DWARFDIE method_die) {
2103 property.Finalize();
2107 if (!bases.empty()) {
2111 for (
const auto &base_class : bases) {
2112 clang::TypeSourceInfo *type_source_info = base_class->getTypeSourceInfo();
2113 if (type_source_info)
2130 clang::CXXRecordDecl *record_decl =
2139 auto IM = record_decl->calculateInheritanceModel();
2140 record_decl->addAttr(clang::MSInheritanceAttr::CreateImplicit(
2142 clang::MSInheritanceAttr::Spelling(IM)));
2149 for (
const DWARFDIE &die : contained_type_dies)
2150 dwarf->ResolveType(die);
2152 return (
bool)clang_type;
2160 bool is_signed =
false;
2167 return (
bool)clang_type;
2175 std::lock_guard<std::recursive_mutex> guard(
2176 dwarf->GetObjectFile()->GetModule()->GetMutex());
2189 case DW_TAG_structure_type:
2190 case DW_TAG_union_type:
2191 case DW_TAG_class_type:
2194 case DW_TAG_enumeration_type:
2198 assert(
false &&
"not a forward clang type decl!");
2215 auto opaque_decl_ctx =
2226 if (clang_decl !=
nullptr)
2241 clang::DeclContext *clang_decl_ctx =
2250 uint32_t enumerator_byte_size,
const DWARFDIE &parent_die) {
2254 size_t enumerators_added = 0;
2258 if (tag != DW_TAG_enumerator)
2262 if (attributes.
Size() == 0)
2265 const char *name =
nullptr;
2266 bool got_value =
false;
2267 int64_t enum_value = 0;
2270 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2275 case DW_AT_const_value:
2278 enum_value = form_value.
Signed();
2280 enum_value = form_value.
Unsigned();
2287 case DW_AT_description:
2289 case DW_AT_decl_file:
2293 case DW_AT_decl_line:
2296 case DW_AT_decl_column:
2305 if (name && name[0] && got_value) {
2307 clang_type, decl, name, enum_value, enumerator_byte_size * 8);
2308 ++enumerators_added;
2311 return enumerators_added;
2316 bool is_static =
false;
2317 bool is_variadic =
false;
2318 bool has_template_params =
false;
2319 unsigned type_quals = 0;
2320 std::vector<CompilerType> param_types;
2321 std::vector<clang::ParmVarDecl *> param_decls;
2327 clang::DeclContext *containing_decl_ctx =
2330 has_template_params, param_types, param_decls,
2333 for (
size_t i = 0; i < param_types.size(); i++) {
2336 sstr << param_types[i].GetTypeName();
2341 if (type_quals & clang::Qualifiers::Const)
2349 llvm::DWARFAddressRangesVector unused_func_ranges;
2350 const char *name =
nullptr;
2351 const char *mangled =
nullptr;
2352 std::optional<int> decl_file;
2353 std::optional<int> decl_line;
2354 std::optional<int> decl_column;
2355 std::optional<int> call_file;
2356 std::optional<int> call_line;
2357 std::optional<int> call_column;
2362 if (tag != DW_TAG_subprogram)
2366 decl_line, decl_column, call_file, call_line,
2367 call_column, &frame_base)) {
2371 else if ((die.
GetParent().
Tag() == DW_TAG_compile_unit ||
2377 name && strcmp(name,
"main") != 0) {
2386 std::unique_ptr<Declaration> decl_up;
2387 if (decl_file || decl_line || decl_column)
2388 decl_up = std::make_unique<Declaration>(
2390 decl_line ? *decl_line : 0, decl_column ? *decl_column : 0);
2399 func_sp = std::make_shared<Function>(
2402 func_user_id, func_name, func_type, std::move(func_ranges));
2404 if (func_sp.get() !=
nullptr) {
2406 func_sp->GetFrameBaseExpression() = frame_base;
2408 return func_sp.get();
2417struct PropertyAttributes {
2418 explicit PropertyAttributes(
const DWARFDIE &die);
2419 const char *prop_name =
nullptr;
2420 const char *prop_getter_name =
nullptr;
2421 const char *prop_setter_name =
nullptr;
2423 uint32_t prop_attributes = 0;
2426struct DiscriminantValue {
2429 uint32_t byte_offset;
2434struct VariantMember {
2436 bool IsDefault()
const;
2438 std::optional<uint32_t> discr_value;
2441 uint32_t byte_offset;
2449 std::vector<VariantMember> &members();
2451 DiscriminantValue &discriminant();
2454 std::vector<VariantMember> _members;
2455 DiscriminantValue _discriminant;
2460ConstString VariantMember::GetName()
const {
return this->variant_name; }
2462bool VariantMember::IsDefault()
const {
return !discr_value; }
2465 assert(die.
Tag() == llvm::dwarf::DW_TAG_variant);
2469 for (
auto child_die : die.
children()) {
2470 switch (child_die.Tag()) {
2471 case llvm::dwarf::DW_TAG_member: {
2473 for (std::size_t i = 0; i < attributes.
Size(); ++i) {
2482 type_ref = form_value;
2485 case DW_AT_data_member_location:
2486 if (
auto maybe_offset =
2488 byte_offset = *maybe_offset;
2505DiscriminantValue::DiscriminantValue(
const DWARFDIE &die,
ModuleSP module_sp) {
2508 for (std::size_t i = 0; i < attributes.
Size(); ++i) {
2514 type_ref = form_value;
2516 case DW_AT_data_member_location:
2517 if (
auto maybe_offset =
2519 byte_offset = *maybe_offset;
2530 : _members(), _discriminant(die, module_sp) {
2532 for (
auto child : die.
children()) {
2533 if (child.Tag() == llvm::dwarf::DW_TAG_variant) {
2534 _members.push_back(VariantMember(child, module_sp));
2539std::vector<VariantMember> &VariantPart::members() {
return this->_members; }
2541DiscriminantValue &VariantPart::discriminant() {
return this->_discriminant; }
2546 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2557 case DW_AT_bit_offset:
2560 case DW_AT_bit_size:
2563 case DW_AT_byte_size:
2566 case DW_AT_const_value:
2569 case DW_AT_data_bit_offset:
2572 case DW_AT_data_member_location:
2573 if (
auto maybe_offset =
2578 case DW_AT_accessibility:
2582 case DW_AT_artificial:
2585 case DW_AT_declaration:
2612PropertyAttributes::PropertyAttributes(
const DWARFDIE &die) {
2615 for (
size_t i = 0; i < attributes.
Size(); ++i) {
2620 case DW_AT_APPLE_property_name:
2623 case DW_AT_APPLE_property_getter:
2624 prop_getter_name = form_value.
AsCString();
2626 case DW_AT_APPLE_property_setter:
2627 prop_setter_name = form_value.
AsCString();
2629 case DW_AT_APPLE_property_attribute:
2630 prop_attributes = form_value.
Unsigned();
2644 if (prop_getter_name && prop_getter_name[0] ==
'-') {
2645 std::optional<const ObjCLanguage::MethodName> prop_getter_method =
2647 if (prop_getter_method)
2652 if (prop_setter_name && prop_setter_name[0] ==
'-') {
2653 std::optional<const ObjCLanguage::MethodName> prop_setter_method =
2655 if (prop_setter_method)
2661 if (!prop_getter_name)
2662 prop_getter_name = prop_name;
2663 if (!prop_setter_name && prop_name[0] &&
2664 !(prop_attributes & DW_APPLE_PROPERTY_readonly)) {
2667 ss.
Printf(
"set%c%s:", toupper(prop_name[0]), &prop_name[1]);
2670 prop_setter_name = fixed_setter.
GetCString();
2679 assert(die.
Tag() == DW_TAG_APPLE_property);
2684 const PropertyAttributes propAttrs(die);
2686 if (!propAttrs.prop_name) {
2687 module_sp->ReportError(
"{0:x8}: DW_TAG_APPLE_property has no name.",
2694 module_sp->ReportError(
2695 "{0:x8}: DW_TAG_APPLE_property '{1}' refers to type {2:x16}"
2696 " which was unable to be parsed",
2697 die.
GetID(), propAttrs.prop_name,
2704 delayed_properties.emplace_back(
2705 class_clang_type, propAttrs.prop_name,
2707 propAttrs.prop_getter_name, propAttrs.prop_attributes, metadata);
2713 assert(qt->isIntegralOrEnumerationType());
2716 return llvm::createStringError(llvm::inconvertibleErrorCode(),
2717 "TypeSystem not clang");
2721 const unsigned type_bits = ast.getIntWidth(qt);
2722 const bool is_unsigned = qt->isUnsignedIntegerType();
2726 constexpr std::size_t max_bit_size = 64;
2731 if (type_bits > max_bit_size) {
2732 auto msg = llvm::formatv(
"Can only parse integers with up to {0} bits, but "
2733 "given integer has {1} bits.",
2734 max_bit_size, type_bits);
2735 return llvm::createStringError(llvm::inconvertibleErrorCode(), msg.str());
2739 llvm::APInt result(max_bit_size, form_value.
Unsigned(), !is_unsigned);
2745 const unsigned required_bits =
2746 is_unsigned ? result.getActiveBits() : result.getSignificantBits();
2749 if (required_bits > type_bits) {
2750 std::string value_as_str = is_unsigned
2751 ? std::to_string(form_value.
Unsigned())
2752 : std::to_string(form_value.
Signed());
2753 auto msg = llvm::formatv(
"Can't store {0} value {1} in integer with {2} "
2755 (is_unsigned ?
"unsigned" :
"signed"),
2756 value_as_str, type_bits);
2757 return llvm::createStringError(llvm::inconvertibleErrorCode(), msg.str());
2761 if (result.getBitWidth() > type_bits)
2762 result = result.trunc(type_bits);
2769 Log *log =
GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
2770 assert(die.
Tag() == DW_TAG_member || die.
Tag() == DW_TAG_variable);
2777 auto accessibility =
2782 class_clang_type, attrs.
name, ct, accessibility);
2784 LLDB_LOG(log,
"Failed to add variable to the record type");
2793 llvm::Expected<llvm::APInt> const_value_or_err =
2795 if (!const_value_or_err) {
2797 "Failed to add const value to variable {1}: {0}",
2798 v->getQualifiedNameAsString());
2812 assert(die.
Tag() == DW_TAG_member);
2817 const uint64_t parent_byte_size =
2819 const uint64_t parent_bit_size =
2844 module_sp->ReportError(
2845 "{0:x8}: DW_TAG_member '{1}' refers to type {2:x16}"
2846 " which was unable to be parsed",
2849 module_sp->ReportError(
"{0:x8}: DW_TAG_member refers to type {1:x16}"
2850 " which was unable to be parsed",
2856 const uint64_t character_width = 8;
2860 ? default_accessibility
2869 this_field_info.
bit_offset = field_bit_offset;
2881 this_field_info.
bit_offset += byte_size.value_or(0) * 8;
2895 !(parent_die.
Tag() == DW_TAG_union_type &&
2897 ((this_field_info.
bit_offset >= parent_bit_size) ||
2903 "{0:x16}: {1} ({2}) bitfield named \"{3}\" has invalid "
2904 "bit offset ({4:x8}) member will be ignored. Please file a bug "
2906 "compiler and include the preprocessed output for {5}\n",
2913 field_bit_offset = this_field_info.
bit_offset;
2918 bool detect_unnamed_bitfields =
true;
2921 detect_unnamed_bitfields =
2924 if (detect_unnamed_bitfields)
2926 last_field_info, this_field_info);
2928 last_field_info = this_field_info;
2933 this_field_info.
bit_offset = field_bit_offset;
2937 if (std::optional<uint64_t> clang_type_size =
2939 this_field_info.
bit_size = *clang_type_size * character_width;
2946 last_field_info = this_field_info;
2969 uint64_t member_array_size;
2970 bool member_array_is_incomplete;
2972 if (member_clang_type.
IsArrayType(&member_array_element_type,
2974 &member_array_is_incomplete) &&
2975 !member_array_is_incomplete) {
2976 uint64_t parent_byte_size =
2980 if (member_array_size != 1 &&
2981 (member_array_size != 0 ||
2983 module_sp->ReportError(
2984 "{0:x8}: DW_TAG_member '{1}' refers to type {2:x16}"
2985 " which extends beyond the bounds of {3:x8}",
2999 class_clang_type, attrs.
name, member_clang_type, accessibility,
3005 std::make_pair(field_decl, field_bit_offset));
3010 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
3011 std::vector<DWARFDIE> &member_function_dies,
3012 std::vector<DWARFDIE> &contained_type_dies,
3031 case DW_TAG_APPLE_property:
3035 case DW_TAG_variant_part:
3038 default_accessibility, layout_info);
3042 case DW_TAG_variable: {
3048 default_accessibility, layout_info, last_field_info);
3051 case DW_TAG_subprogram:
3053 member_function_dies.push_back(die);
3056 case DW_TAG_inheritance:
3058 module_sp, base_classes, layout_info);
3062 if (llvm::dwarf::isType(tag))
3063 contained_type_dies.push_back(die);
3072 clang::DeclContext *containing_decl_ctx,
const DWARFDIE &parent_die,
3073 bool skip_artificial,
bool &is_static,
bool &is_variadic,
3074 bool &has_template_params, std::vector<CompilerType> &function_param_types,
3075 std::vector<clang::ParmVarDecl *> &function_param_decls,
3076 unsigned &type_quals) {
3084 case DW_TAG_formal_parameter: {
3086 if (attributes.
Size() == 0) {
3091 const char *name =
nullptr;
3093 bool is_artificial =
false;
3096 clang::StorageClass storage = clang::SC_None;
3098 for (i = 0; i < attributes.
Size(); ++i) {
3107 param_type_die_form = form_value;
3109 case DW_AT_artificial:
3110 is_artificial = form_value.
Boolean();
3112 case DW_AT_location:
3113 case DW_AT_const_value:
3114 case DW_AT_default_value:
3115 case DW_AT_description:
3116 case DW_AT_endianity:
3117 case DW_AT_is_optional:
3119 case DW_AT_variable_parameter:
3121 case DW_AT_abstract_origin:
3129 if (skip_artificial && is_artificial) {
3137 (name ==
nullptr || ::strcmp(name,
"this") == 0)) {
3145 type_quals |= clang::Qualifiers::Const;
3147 type_quals |= clang::Qualifiers::Volatile;
3162 assert(param_var_decl);
3163 function_param_decls.push_back(param_var_decl);
3171 case DW_TAG_unspecified_parameters:
3175 case DW_TAG_template_type_parameter:
3176 case DW_TAG_template_value_parameter:
3177 case DW_TAG_GNU_template_parameter_pack:
3183 has_template_params =
true;
3197 switch (die.
Tag()) {
3198 case DW_TAG_constant:
3199 case DW_TAG_formal_parameter:
3200 case DW_TAG_imported_declaration:
3201 case DW_TAG_imported_module:
3203 case DW_TAG_variable:
3217 return cache_pos->second;
3232 clang::Decl *decl =
nullptr;
3233 switch (die.
Tag()) {
3234 case DW_TAG_variable:
3235 case DW_TAG_constant:
3236 case DW_TAG_formal_parameter: {
3239 if (
dwarf && type) {
3240 const char *name = die.
GetName();
3241 clang::DeclContext *decl_context =
3243 dwarf->GetDeclContextContainingUID(die.
GetID()));
3250 case DW_TAG_imported_declaration: {
3255 if (imported_decl) {
3256 clang::DeclContext *decl_context =
3258 dwarf->GetDeclContextContainingUID(die.
GetID()));
3259 if (clang::NamedDecl *clang_imported_decl =
3260 llvm::dyn_cast<clang::NamedDecl>(
3268 case DW_TAG_imported_module: {
3275 if (imported_decl_ctx) {
3276 clang::DeclContext *decl_context =
3278 dwarf->GetDeclContextContainingUID(die.
GetID()));
3279 if (clang::NamespaceDecl *ns_decl =
3304 bool try_parsing_type =
true;
3305 switch (die.
Tag()) {
3306 case DW_TAG_compile_unit:
3307 case DW_TAG_partial_unit:
3309 try_parsing_type =
false;
3312 case DW_TAG_namespace:
3314 try_parsing_type =
false;
3317 case DW_TAG_imported_declaration:
3319 try_parsing_type =
false;
3322 case DW_TAG_lexical_block:
3324 try_parsing_type =
false;
3331 if (decl_ctx ==
nullptr && try_parsing_type) {
3351 parent = parent.GetParent()) {
3353 if (tag == DW_TAG_module) {
3373 switch (die.
Tag()) {
3374 case DW_TAG_subprogram:
3375 case DW_TAG_inlined_subroutine:
3385 if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) {
3392 assert(0 &&
"Shouldn't call GetContainingFunctionWithAbstractOrigin on "
3393 "something not in a function");
3399 if (candidate.GetReferencedDIE(DW_AT_abstract_origin)) {
3421 assert(die.
Tag() == DW_TAG_lexical_block);
3422 DWARFDIE containing_function_with_abstract_origin =
3424 if (!containing_function_with_abstract_origin) {
3428 die, containing_function_with_abstract_origin);
3435 if (die && die.
Tag() == DW_TAG_lexical_block) {
3436 clang::BlockDecl *decl =
3441 clang::DeclContext *decl_context =
3455clang::NamespaceDecl *
3457 if (die && die.
Tag() == DW_TAG_namespace) {
3460 clang::NamespaceDecl *namespace_decl =
3463 return namespace_decl;
3465 const char *namespace_name = die.
GetName();
3466 clang::DeclContext *containing_decl_ctx =
3477 return namespace_decl;
3483clang::NamespaceDecl *
3485 assert(die && die.
Tag() == DW_TAG_imported_declaration);
3491 return static_cast<clang::NamespaceDecl *
>(it->getSecond());
3493 clang::NamespaceDecl *namespace_decl =
nullptr;
3500 switch (imported_uid.
Tag()) {
3501 case DW_TAG_imported_declaration:
3504 case DW_TAG_namespace:
3511 if (!namespace_decl)
3516 return namespace_decl;
3523 DWARFDIE decl_ctx_die =
dwarf->GetDeclContextDIEContainingDIE(die);
3525 if (decl_ctx_die_copy)
3526 *decl_ctx_die_copy = decl_ctx_die;
3529 clang::DeclContext *clang_decl_ctx =
3532 return clang_decl_ctx;
3558 if (!class_type || !src_class_die || !dst_class_die)
3560 if (src_class_die.
Tag() != dst_class_die.
Tag())
3570 if (die.
Tag() != DW_TAG_subprogram)
3582 map_artificial.Append(const_name, die);
3584 map.Append(const_name, die);
3593 src_die = src_die.GetSibling()) {
3594 gather(src_die, src_name_to_die, src_name_to_die_artificial);
3597 dst_die = dst_die.GetSibling()) {
3598 gather(dst_die, dst_name_to_die, dst_name_to_die_artificial);
3600 const uint32_t src_size = src_name_to_die.
GetSize();
3601 const uint32_t dst_size = dst_name_to_die.
GetSize();
3604 bool fast_path =
true;
3606 if (src_size != dst_size)
3612 for (idx = 0; idx < src_size; ++idx) {
3616 if (src_die.
Tag() != dst_die.
Tag())
3623 if (src_name == dst_name || (strcmp(src_name, dst_name) == 0))
3639 clang::DeclContext *dst_decl_ctx =
3644 if (
Type *src_child_type = die_to_type.lookup(src.
GetDIE()))
3645 die_to_type[dst.GetDIE()] = src_child_type;
3652 for (idx = 0; idx < src_size; ++idx) {
3662 src_name_to_die.
Sort();
3664 for (idx = 0; idx < dst_size; ++idx) {
3669 if (src_die && (src_die.
Tag() == dst_die.
Tag()))
3670 link(src_die, dst_die);
3672 failures.push_back(dst_die);
3677 const uint32_t src_size_artificial = src_name_to_die_artificial.
GetSize();
3678 const uint32_t dst_size_artificial = dst_name_to_die_artificial.
GetSize();
3680 if (src_size_artificial && dst_size_artificial) {
3681 dst_name_to_die_artificial.
Sort();
3683 for (idx = 0; idx < src_size_artificial; ++idx) {
3689 dst_name_to_die_artificial.
Find(src_name_artificial,
DWARFDIE());
3693 link(src_die, dst_die);
3697 if (dst_size_artificial) {
3698 for (idx = 0; idx < dst_size_artificial; ++idx) {
3704 return !failures.empty();
3708 FieldInfo const &last_field_info, uint64_t last_field_end,
3713 if (this_field_info.
bit_offset <= last_field_end)
3727 const bool have_base = layout_info.
base_offsets.size() != 0;
3728 const bool this_is_first_field =
3730 const bool first_field_is_vptr =
3733 if (have_base && (this_is_first_field || first_field_is_vptr))
3744 const uint64_t word_width = 32;
3752 if (last_field_end != 0 && ((last_field_end % word_width) != 0))
3753 last_field_end += word_width - (last_field_end % word_width);
3758 current_field, class_layout_info))
3763 const uint64_t unnamed_bit_size = current_field.
bit_offset - last_field_end;
3764 const uint64_t unnamed_bit_offset = last_field_end;
3766 clang::FieldDecl *unnamed_bitfield_decl =
3768 class_clang_type, llvm::StringRef(),
3773 std::make_pair(unnamed_bitfield_decl, unnamed_bit_offset));
3781 assert(die.
Tag() == llvm::dwarf::DW_TAG_variant_part);
3783 LanguageType::eLanguageTypeRust);
3787 VariantPart variants(die, parent_die, module_sp);
3789 auto discriminant_type =
3790 die.
ResolveTypeUID(variants.discriminant().type_ref.Reference());
3797 llvm::formatv(
"{0}$Inner", class_clang_type.
GetTypeName(
false))),
3802 for (
auto member : variants.members()) {
3804 auto has_discriminant = !member.IsDefault();
3806 auto member_type = die.
ResolveTypeUID(member.type_ref.Reference());
3811 std::string(llvm::formatv(
"{0}$Variant", member.GetName())),
3812 llvm::to_underlying(clang::TagTypeKind::Struct),
3816 auto offset = member.byte_offset;
3818 if (has_discriminant) {
3820 field_type,
"$discr$", discriminant_type->GetFullCompilerType(),
3822 offset += discriminant_type->GetByteSize(
nullptr).value_or(0);
3826 member_type->GetFullCompilerType(),
3831 auto name = has_discriminant
3832 ? llvm::formatv(
"$variant${0}", member.discr_value.value())
3833 : std::string(
"$variant$");
3837 field_type, default_accesibility, 0);
3843 llvm::StringRef(
"$variants$"),
static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind)
static std::string GetUnitName(const DWARFDIE &die)
static clang::CallingConv ConvertDWARFCallingConventionToClang(const ParsedDWARFTypeAttributes &attrs)
static bool IsSubroutine(const DWARFDIE &die)
static TypePayloadClang GetPtrAuthMofidierPayload(const DWARFDIE &die)
static bool TagIsRecordType(dw_tag_t tag)
Returns true for C++ constructs represented by clang::CXXRecordDecl.
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 ensures we are able to add members (nested types, functions, etc.) to this type.
static std::optional< uint32_t > ExtractDataMemberLocation(DWARFDIE const &die, DWARFFormValue const &form_value, ModuleSP module_sp)
static bool ShouldIgnoreArtificialField(llvm::StringRef FieldName)
#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
static llvm::StringRef GetName(XcodeSDK::Type type)
const char * m_property_getter_name
CompilerType m_class_opaque_type
CompilerType m_property_opaque_type
const char * m_property_setter_name
uint32_t m_property_attributes
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, ClangASTMetadata metadata)
ClangASTMetadata m_metadata
const char * m_property_name
lldb::TypeSP ParsePointerToMemberType(const lldb_private::plugin::dwarf::DWARFDIE &die, const ParsedDWARFTypeAttributes &attrs)
bool CompleteEnumType(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, const lldb_private::CompilerType &clang_type)
void ParseRustVariantPart(lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::DWARFDIE &parent_die, const lldb_private::CompilerType &class_clang_type, const lldb::AccessType default_accesibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
Parses DW_TAG_variant_part DIE into a structure that encodes all variants Note that this is currently...
clang::NamespaceDecl * ResolveImportedDeclarationDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
Returns the namespace decl that a DW_TAG_imported_declaration imports.
void CreateStaticMemberVariable(const lldb_private::plugin::dwarf::DWARFDIE &die, const MemberAttributes &attrs, const lldb_private::CompilerType &class_clang_type)
If the specified 'die' represents a static data member, creates a 'clang::VarDecl' for it and attache...
size_t ParseChildParameters(clang::DeclContext *containing_decl_ctx, const lldb_private::plugin::dwarf::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)
std::unique_ptr< lldb_private::ClangASTImporter > m_clang_ast_importer_up
lldb::TypeSP ParseEnum(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
std::string GetDIEClassTemplateParams(lldb_private::plugin::dwarf::DWARFDIE die) override
Returns the template parameters of a class DWARFDIE as a string.
lldb::TypeSP UpdateSymbolContextScopeForType(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::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_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.
bool CompleteTypeFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, const lldb_private::CompilerType &compiler_type) override
lldb::TypeSP ParseArrayType(const lldb_private::plugin::dwarf::DWARFDIE &die, const ParsedDWARFTypeAttributes &attrs)
lldb_private::ClangASTImporter & GetClangASTImporter()
clang::BlockDecl * ResolveBlockDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, bool *type_is_new_ptr) override
clang::DeclContext * GetClangDeclContextContainingDIE(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::plugin::dwarf::DWARFDIE *decl_ctx_die)
clang::DeclContext * GetDeclContextForBlock(const lldb_private::plugin::dwarf::DWARFDIE &die)
bool CompleteRecordType(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, const lldb_private::CompilerType &clang_type)
void ParseInheritance(const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::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.
bool ParseChildMembers(const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::CompilerType &class_compiler_type, std::vector< std::unique_ptr< clang::CXXBaseSpecifier > > &base_classes, std::vector< lldb_private::plugin::dwarf::DWARFDIE > &member_function_dies, std::vector< lldb_private::plugin::dwarf::DWARFDIE > &contained_type_dies, DelayedPropertyList &delayed_properties, const lldb::AccessType default_accessibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info)
lldb::TypeSP ParseTypeModifier(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
lldb::TypeSP ParseTypeFromClangModule(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Log *log)
Follow Clang Module Skeleton CU references to find a type definition.
DIEToDeclContextMap m_die_to_decl_ctx
void ParseObjCProperty(const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::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...
void EnsureAllDIEsInDeclContextHaveBeenParsed(lldb_private::CompilerDeclContext decl_context) override
clang::NamespaceDecl * ResolveNamespaceDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
void GetUniqueTypeNameAndDeclaration(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb::LanguageType language, lldb_private::ConstString &unique_typename, lldb_private::Declaration &decl_declaration)
lldb_private::ConstString ConstructDemangledNameFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die) override
lldb_private::CompilerDeclContext GetDeclContextContainingUIDFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die) override
lldb::TypeSP ParseStructureLikeDIE(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, ParsedDWARFTypeAttributes &attrs)
Parse a structure, class, or union type DIE.
DIEToDeclMap m_die_to_decl
size_t ParseChildEnumerators(const lldb_private::CompilerType &compiler_type, bool is_signed, uint32_t enumerator_byte_size, const lldb_private::plugin::dwarf::DWARFDIE &parent_die)
~DWARFASTParserClang() override
std::vector< DelayedAddObjCClassProperty > DelayedPropertyList
bool CopyUniqueClassMethodTypes(const lldb_private::plugin::dwarf::DWARFDIE &src_class_die, const lldb_private::plugin::dwarf::DWARFDIE &dst_class_die, lldb_private::Type *class_type, std::vector< lldb_private::plugin::dwarf::DWARFDIE > &failures)
clang::DeclContext * GetClangDeclContextForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
bool ParseTemplateDIE(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos)
lldb_private::CompilerDeclContext GetDeclContextForUIDFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die) override
llvm::Expected< llvm::APInt > ExtractIntFromFormValue(const lldb_private::CompilerType &int_type, const lldb_private::plugin::dwarf::DWARFFormValue &form_value) const
Extracts an value for a given Clang integer type from a DWARFFormValue.
clang::DeclContext * GetCachedClangDeclContextForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
DIEToModuleMap m_die_to_module
void ParseSingleMember(const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::DWARFDIE &parent_die, const lldb_private::CompilerType &class_clang_type, lldb::AccessType default_accessibility, lldb_private::ClangASTImporter::LayoutInfo &layout_info, FieldInfo &last_field_info)
DeclContextToDIEMap m_decl_ctx_to_die
lldb_private::Function * ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit, const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::AddressRanges func_ranges) override
void AddUnnamedBitfieldToRecordTypeIfNeeded(lldb_private::ClangASTImporter::LayoutInfo &class_layout_info, const lldb_private::CompilerType &class_clang_type, const FieldInfo &previous_field, const FieldInfo ¤t_field)
Tries to detect whether class_clang_type contained an unnamed bit-field between previous_field and cu...
std::pair< bool, lldb::TypeSP > ParseCXXMethod(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::CompilerType clang_type, const ParsedDWARFTypeAttributes &attrs, const lldb_private::plugin::dwarf::DWARFDIE &decl_ctx_die, bool is_static, bool &ignore_containing_context)
Helper function called by ParseSubroutine when parsing C++ methods.
lldb::TypeSP ParseSubroutine(const lldb_private::plugin::dwarf::DWARFDIE &die, const ParsedDWARFTypeAttributes &attrs)
void MapDeclDIEToDefDIE(const lldb_private::plugin::dwarf::DWARFDIE &decl_die, const lldb_private::plugin::dwarf::DWARFDIE &def_die)
bool ParseObjCMethod(const lldb_private::ObjCLanguage::MethodName &objc_method, const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::CompilerType clang_type, const ParsedDWARFTypeAttributes &attrs, bool is_variadic)
Helper function called by ParseSubroutine when parsing ObjC-methods.
lldb_private::CompilerDecl GetDeclForUIDFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die) override
bool ParseTemplateParameterInfos(const lldb_private::plugin::dwarf::DWARFDIE &parent_die, lldb_private::TypeSystemClang::TemplateParameterInfos &template_param_infos)
clang::Decl * GetClangDeclForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die)
void LinkDeclContextToDIE(clang::DeclContext *decl_ctx, const lldb_private::plugin::dwarf::DWARFDIE &die)
lldb_private::OptionalClangModuleID GetOwningClangModule(const lldb_private::plugin::dwarf::DWARFDIE &die)
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.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
void SetString(llvm::StringRef s)
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 llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::ModuleSP module_sp, const DataExtractor &opcodes, const plugin::dwarf::DWARFUnit *dwarf_cu, const lldb::RegisterKind reg_set, const Value *initial_value_ptr, const Value *object_address_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)
A class that handles mangled names.
void SetValue(ConstString name)
Set the string value in this object.
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.
llvm::StringRef GetClassName() const
Returns a reference to the class name.
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.
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 FirstType() const
The implementation of lldb::Type's m_payload field for TypeSystemClang.
A class that contains all state required for type lookups.
void AddLanguage(lldb::LanguageType language)
Add a language family to the list of languages that should produce a match.
This class tracks the state and results of a TypeQuery.
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
llvm::DenseSet< lldb_private::SymbolFile * > & GetSearchedSymbolFiles()
Access the set of searched symbol files.
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()
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)
CompilerType CreateArrayType(const CompilerType &element_type, std::optional< size_t > element_count, bool is_vector)
bool SetDeclIsForcefullyCompleted(const clang::TagDecl *td)
static clang::DeclContext * GetDeclContextForType(clang::QualType type)
static bool IsCXXClassType(const CompilerType &type)
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.
static void SetIsPacked(const CompilerType &type)
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...
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)
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)
static bool CompleteTagDeclarationDefinition(const CompilerType &type)
static clang::ObjCMethodDecl * AddMethodToObjCObjectType(const CompilerType &type, const char *name, const CompilerType &method_compiler_type, bool is_artificial, bool is_variadic, bool is_objc_direct_call)
CompilerType CreateRecordType(clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module, lldb::AccessType access_type, llvm::StringRef name, int kind, lldb::LanguageType language, std::optional< ClangASTMetadata > metadata=std::nullopt, bool exports_symbols=false)
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)
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern)
void SetMetadata(const clang::Decl *object, ClangASTMetadata meta_data)
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 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)
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)
clang::ASTContext & getASTContext() const
Returns the clang::ASTContext instance managed by this TypeSystemClang.
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.
@ eEncodingIsLLVMPtrAuthUID
This type is a signed pointer.
@ 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
lldb_private::Type * GetTypeForDIE(const DWARFDIE &die)
static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility)
static std::optional< SymbolFile::ArrayInfo > ParseChildArrayInfo(const DWARFDIE &parent_die, const ExecutionContext *exe_ctx=nullptr)
DWARFUnit * CompileUnitAtIndex(uint32_t i) const
dw_attr_t AttributeAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
std::optional< uint64_t > GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const
const DWARFDataExtractor & GetData() const
const char * GetAttributeValueAsString(const dw_attr_t attr, const char *fail_value) const
std::optional< DIERef > GetDIERef() const
SymbolFileDWARF * GetDWARF() const
DWARFUnit * GetCU() 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(Stream &s) const
const char * GetMangledName(bool substitute_name_allowed=true) const
DWARFDIE GetFirstChild() const
DWARFDIE GetParent() const
bool GetDIENamesAndRanges(const char *&name, const char *&mangled, llvm::DWARFAddressRangesVector &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, DWARFExpressionList *frame_base) const
std::vector< CompilerContext > GetDeclContext() const
Return this DIE's decl context as it is needed to look up types in Clang modules.
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
Type * ResolveTypeUID(const DWARFDIE &die) const
DWARFDIE GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const
DWARFDeclContext GetDWARFDeclContext() const
DWARFDIE GetReferencedDIE(const dw_attr_t attr) const
Type * ResolveType() const
const char * GetQualifiedName() const
SymbolFileDWARF & GetSymbolFileDWARF() const
bool Supports_unnamed_objc_bitfields()
uint64_t GetDWARFLanguageType()
FileSpec GetFile(size_t file_idx)
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
lldb::ModuleSP GetExternalModule(ConstString name)
llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > DIEToTypePtr
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
static CompilerDecl GetDecl(const DWARFDIE &die)
virtual DIEToTypePtr & GetDIEToType()
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
static CompilerDeclContext GetDeclContext(const DWARFDIE &die)
llvm::dwarf::Tag dw_tag_t
llvm::dwarf::Attribute dw_attr_t
#define UNUSED_IF_ASSERT_DISABLED(x)
llvm::StringRef DW_TAG_value_to_name(dw_tag_t tag)
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.
std::shared_ptr< lldb_private::Function > FunctionSP
LanguageType
Programming language type.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeObjC
Objective-C.
std::shared_ptr< lldb_private::Type > TypeSP
@ eEncodingSint
signed integer
std::shared_ptr< lldb_private::Module > ModuleSP
@ eRegisterKindDWARF
the register numbers seen DWARF
void SetIsArtificial(bool flag)
uint64_t GetEffectiveFieldEnd() const
If this field was folded into storage of a previous field, returns the offset in bits of where that s...
bool IsArtificial() const
uint64_t bit_offset
Offset of this field in bits from the beginning of the containing struct.
void SetEffectiveFieldEnd(uint64_t val)
bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const
uint64_t GetFieldEnd() const
Returns the offset in bits of where the storage this field occupies ends.
void SetIsBitfield(bool flag)
uint64_t bit_size
Size in bits that this field occupies.
bool is_bitfield
Set to 'true' if this field is a bit-field.
Parsed form of all attributes that are relevant for parsing type members.
std::optional< uint64_t > byte_size
int64_t bit_offset
Indicates how many bits into the word (according to the host endianness) the low-order bit of the fie...
uint32_t member_byte_offset
Indicates the byte offset of the word from the base address of the structure.
lldb::AccessType accessibility
lldb_private::plugin::dwarf::DWARFFormValue encoding_form
size_t bit_size
Indicates the size of the field in bits.
std::optional< lldb_private::plugin::dwarf::DWARFFormValue > const_value_form
MemberAttributes(const lldb_private::plugin::dwarf::DWARFDIE &die, const lldb_private::plugin::dwarf::DWARFDIE &parent_die, lldb::ModuleSP module_sp)
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
std::optional< uint64_t > alignment
bool is_complete_objc_class
lldb::LanguageType class_language
bool is_forward_declaration
std::optional< uint64_t > byte_size
lldb_private::plugin::dwarf::DWARFFormValue signature
lldb_private::plugin::dwarf::DWARFFormValue type
lldb_private::plugin::dwarf::DWARFDIE object_pointer
clang::StorageClass storage
ParsedDWARFTypeAttributes(const lldb_private::plugin::dwarf::DWARFDIE &die)
clang::RefQualifierKind ref_qual
Indicates ref-qualifier of C++ member function if present.
lldb_private::plugin::dwarf::DWARFFormValue specification
lldb_private::plugin::dwarf::DWARFFormValue abstract_origin
lldb_private::plugin::dwarf::DWARFFormValue containing_type
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)
lldb::user_id_t GetID() const
Get accessor for the user ID.