1 //===-- DWARFASTParserClang.h -----------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H 10 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H 11 12 #include "clang/AST/CharUnits.h" 13 #include "clang/AST/Type.h" 14 #include "llvm/ADT/DenseMap.h" 15 #include "llvm/ADT/SmallPtrSet.h" 16 #include "llvm/ADT/SmallVector.h" 17 18 #include "DWARFASTParser.h" 19 #include "DWARFDIE.h" 20 #include "DWARFDefines.h" 21 #include "DWARFFormValue.h" 22 #include "LogChannelDWARF.h" 23 #include "lldb/Core/PluginInterface.h" 24 25 #include "Plugins/ExpressionParser/Clang/ClangASTImporter.h" 26 #include "Plugins/Language/ObjC/ObjCLanguage.h" 27 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" 28 29 #include <optional> 30 #include <vector> 31 32 namespace lldb_private { 33 class CompileUnit; 34 } 35 namespace lldb_private::plugin { 36 namespace dwarf { 37 class DWARFDebugInfoEntry; 38 class SymbolFileDWARF; 39 } // namespace dwarf 40 } // namespace lldb_private::plugin 41 42 struct ParsedDWARFTypeAttributes; 43 44 class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser { 45 public: 46 DWARFASTParserClang(lldb_private::TypeSystemClang &ast); 47 48 ~DWARFASTParserClang() override; 49 50 // DWARFASTParser interface. 51 lldb::TypeSP 52 ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, 53 const lldb_private::plugin::dwarf::DWARFDIE &die, 54 bool *type_is_new_ptr) override; 55 56 lldb_private::ConstString ConstructDemangledNameFromDWARF( 57 const lldb_private::plugin::dwarf::DWARFDIE &die) override; 58 59 lldb_private::Function * 60 ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit, 61 const lldb_private::plugin::dwarf::DWARFDIE &die, 62 lldb_private::AddressRanges func_ranges) override; 63 64 bool CompleteTypeFromDWARF( 65 const lldb_private::plugin::dwarf::DWARFDIE &die, 66 lldb_private::Type *type, 67 const lldb_private::CompilerType &compiler_type) override; 68 69 lldb_private::CompilerDecl GetDeclForUIDFromDWARF( 70 const lldb_private::plugin::dwarf::DWARFDIE &die) override; 71 72 void EnsureAllDIEsInDeclContextHaveBeenParsed( 73 lldb_private::CompilerDeclContext decl_context) override; 74 75 lldb_private::CompilerDeclContext GetDeclContextForUIDFromDWARF( 76 const lldb_private::plugin::dwarf::DWARFDIE &die) override; 77 78 lldb_private::CompilerDeclContext GetDeclContextContainingUIDFromDWARF( 79 const lldb_private::plugin::dwarf::DWARFDIE &die) override; 80 81 lldb_private::ClangASTImporter &GetClangASTImporter(); 82 83 /// Extracts an value for a given Clang integer type from a DWARFFormValue. 84 /// 85 /// \param int_type The Clang type that defines the bit size and signedness 86 /// of the integer that should be extracted. Has to be either 87 /// an integer type or an enum type. For enum types the 88 /// underlying integer type will be considered as the 89 /// expected integer type that should be extracted. 90 /// \param form_value The DWARFFormValue that contains the integer value. 91 /// \return An APInt containing the same integer value as the given 92 /// DWARFFormValue with the bit width of the given integer type. 93 /// Returns an error if the value in the DWARFFormValue does not fit 94 /// into the given integer type or the integer type isn't supported. 95 llvm::Expected<llvm::APInt> ExtractIntFromFormValue( 96 const lldb_private::CompilerType &int_type, 97 const lldb_private::plugin::dwarf::DWARFFormValue &form_value) const; 98 99 /// Returns the template parameters of a class DWARFDIE as a string. 100 /// 101 /// This is mostly useful for -gsimple-template-names which omits template 102 /// parameters from the DIE name and instead always adds template parameter 103 /// children DIEs. 104 /// 105 /// \param die The struct/class DWARFDIE containing template parameters. 106 /// \return A string, including surrounding '<>', of the template parameters. 107 /// If the DIE's name already has '<>', returns an empty string because 108 /// it's assumed that the caller is using the DIE name anyway. 109 std::string 110 GetDIEClassTemplateParams(lldb_private::plugin::dwarf::DWARFDIE die) override; 111 112 void MapDeclDIEToDefDIE(const lldb_private::plugin::dwarf::DWARFDIE &decl_die, 113 const lldb_private::plugin::dwarf::DWARFDIE &def_die); 114 115 /// Get the object parameter DIE if one exists, otherwise returns 116 /// a default DWARFDIE. 117 /// 118 /// \param[in] subprogram DIE of function for which to get the object 119 /// parameter. \param[in] containing_decl_ctx DIE representing declaration 120 /// context of \a subprogram. If this DIE isn't a valid declaration context 121 /// for class methods, assume no object parameter exists. 122 /// 123 /// \returns DIE of object parameter if one exists. 124 /// 125 lldb_private::plugin::dwarf::DWARFDIE 126 GetObjectParameter(const lldb_private::plugin::dwarf::DWARFDIE &subprogram, 127 const lldb_private::plugin::dwarf::DWARFDIE &decl_ctx_die); 128 129 protected: 130 /// Protected typedefs and members. 131 /// @{ 132 class DelayedAddObjCClassProperty; 133 typedef std::vector<DelayedAddObjCClassProperty> DelayedPropertyList; 134 135 typedef llvm::DenseMap< 136 const lldb_private::plugin::dwarf::DWARFDebugInfoEntry *, 137 clang::DeclContext *> 138 DIEToDeclContextMap; 139 typedef std::multimap<const clang::DeclContext *, 140 const lldb_private::plugin::dwarf::DWARFDIE> 141 DeclContextToDIEMap; 142 typedef llvm::DenseMap< 143 const lldb_private::plugin::dwarf::DWARFDebugInfoEntry *, 144 lldb_private::OptionalClangModuleID> 145 DIEToModuleMap; 146 typedef llvm::DenseMap< 147 const lldb_private::plugin::dwarf::DWARFDebugInfoEntry *, clang::Decl *> 148 DIEToDeclMap; 149 150 lldb_private::TypeSystemClang &m_ast; 151 DIEToDeclMap m_die_to_decl; 152 DIEToDeclContextMap m_die_to_decl_ctx; 153 DeclContextToDIEMap m_decl_ctx_to_die; 154 DIEToModuleMap m_die_to_module; 155 std::unique_ptr<lldb_private::ClangASTImporter> m_clang_ast_importer_up; 156 /// @} 157 158 clang::DeclContext * 159 GetDeclContextForBlock(const lldb_private::plugin::dwarf::DWARFDIE &die); 160 161 clang::BlockDecl * 162 ResolveBlockDIE(const lldb_private::plugin::dwarf::DWARFDIE &die); 163 164 clang::NamespaceDecl * 165 ResolveNamespaceDIE(const lldb_private::plugin::dwarf::DWARFDIE &die); 166 167 /// Returns the namespace decl that a DW_TAG_imported_declaration imports. 168 /// 169 /// \param[in] die The import declaration to resolve. If the DIE is not a 170 /// DW_TAG_imported_declaration the behaviour is undefined. 171 /// 172 /// \returns The decl corresponding to the namespace that the specified 173 /// 'die' imports. If the imported entity is not a namespace 174 /// or another import declaration, returns nullptr. If an error 175 /// occurs, returns nullptr. 176 clang::NamespaceDecl *ResolveImportedDeclarationDIE( 177 const lldb_private::plugin::dwarf::DWARFDIE &die); 178 179 bool ParseTemplateDIE(const lldb_private::plugin::dwarf::DWARFDIE &die, 180 lldb_private::TypeSystemClang::TemplateParameterInfos 181 &template_param_infos); 182 183 bool ParseTemplateParameterInfos( 184 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 185 lldb_private::TypeSystemClang::TemplateParameterInfos 186 &template_param_infos); 187 188 void GetUniqueTypeNameAndDeclaration( 189 const lldb_private::plugin::dwarf::DWARFDIE &die, 190 lldb::LanguageType language, lldb_private::ConstString &unique_typename, 191 lldb_private::Declaration &decl_declaration); 192 193 bool ParseChildMembers( 194 const lldb_private::plugin::dwarf::DWARFDIE &die, 195 const lldb_private::CompilerType &class_compiler_type, 196 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes, 197 std::vector<lldb_private::plugin::dwarf::DWARFDIE> &member_function_dies, 198 std::vector<lldb_private::plugin::dwarf::DWARFDIE> &contained_type_dies, 199 DelayedPropertyList &delayed_properties, 200 const lldb::AccessType default_accessibility, 201 lldb_private::ClangASTImporter::LayoutInfo &layout_info); 202 203 void ParseChildParameters( 204 clang::DeclContext *containing_decl_ctx, 205 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 206 bool &is_variadic, bool &has_template_params, 207 std::vector<lldb_private::CompilerType> &function_param_types, 208 llvm::SmallVectorImpl<llvm::StringRef> &function_param_names); 209 210 size_t ParseChildEnumerators( 211 const lldb_private::CompilerType &compiler_type, bool is_signed, 212 uint32_t enumerator_byte_size, 213 const lldb_private::plugin::dwarf::DWARFDIE &parent_die); 214 215 /// Parse a structure, class, or union type DIE. 216 lldb::TypeSP 217 ParseStructureLikeDIE(const lldb_private::SymbolContext &sc, 218 const lldb_private::plugin::dwarf::DWARFDIE &die, 219 ParsedDWARFTypeAttributes &attrs); 220 221 clang::Decl * 222 GetClangDeclForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die); 223 224 clang::DeclContext * 225 GetClangDeclContextForDIE(const lldb_private::plugin::dwarf::DWARFDIE &die); 226 227 clang::DeclContext *GetClangDeclContextContainingDIE( 228 const lldb_private::plugin::dwarf::DWARFDIE &die, 229 lldb_private::plugin::dwarf::DWARFDIE *decl_ctx_die); 230 lldb_private::OptionalClangModuleID 231 GetOwningClangModule(const lldb_private::plugin::dwarf::DWARFDIE &die); 232 233 bool CopyUniqueClassMethodTypes( 234 const lldb_private::plugin::dwarf::DWARFDIE &src_class_die, 235 const lldb_private::plugin::dwarf::DWARFDIE &dst_class_die, 236 lldb_private::Type *class_type, 237 std::vector<lldb_private::plugin::dwarf::DWARFDIE> &failures); 238 239 clang::DeclContext *GetCachedClangDeclContextForDIE( 240 const lldb_private::plugin::dwarf::DWARFDIE &die); 241 242 void LinkDeclContextToDIE(clang::DeclContext *decl_ctx, 243 const lldb_private::plugin::dwarf::DWARFDIE &die); 244 245 void LinkDeclToDIE(clang::Decl *decl, 246 const lldb_private::plugin::dwarf::DWARFDIE &die); 247 248 /// If \p type_sp is valid, calculate and set its symbol context scope, and 249 /// update the type list for its backing symbol file. 250 /// 251 /// Returns \p type_sp. 252 lldb::TypeSP UpdateSymbolContextScopeForType( 253 const lldb_private::SymbolContext &sc, 254 const lldb_private::plugin::dwarf::DWARFDIE &die, lldb::TypeSP type_sp); 255 256 /// Follow Clang Module Skeleton CU references to find a type definition. 257 lldb::TypeSP 258 ParseTypeFromClangModule(const lldb_private::SymbolContext &sc, 259 const lldb_private::plugin::dwarf::DWARFDIE &die, 260 lldb_private::Log *log); 261 262 // Return true if this type is a declaration to a type in an external 263 // module. 264 lldb::ModuleSP 265 GetModuleForType(const lldb_private::plugin::dwarf::DWARFDIE &die); 266 classof(const DWARFASTParser * Parser)267 static bool classof(const DWARFASTParser *Parser) { 268 return Parser->GetKind() == Kind::DWARFASTParserClang; 269 } 270 271 private: 272 struct FieldInfo { 273 /// Size in bits that this field occupies. Can but 274 /// need not be the DW_AT_bit_size of the field. 275 uint64_t bit_size = 0; 276 277 /// Offset of this field in bits from the beginning 278 /// of the containing struct. Can but need not 279 /// be the DW_AT_data_bit_offset of the field. 280 uint64_t bit_offset = 0; 281 282 /// In case this field is folded into the storage 283 /// of a previous member's storage (for example 284 /// with [[no_unique_address]]), the effective field 285 /// end is the offset in bits from the beginning of 286 /// the containing struct where the field we were 287 /// folded into ended. 288 std::optional<uint64_t> effective_field_end; 289 290 /// Set to 'true' if this field is a bit-field. 291 bool is_bitfield = false; 292 293 /// Set to 'true' if this field is DW_AT_artificial. 294 bool is_artificial = false; 295 296 FieldInfo() = default; 297 SetIsBitfieldFieldInfo298 void SetIsBitfield(bool flag) { is_bitfield = flag; } IsBitfieldFieldInfo299 bool IsBitfield() const { return is_bitfield; } 300 SetIsArtificialFieldInfo301 void SetIsArtificial(bool flag) { is_artificial = flag; } IsArtificialFieldInfo302 bool IsArtificial() const { return is_artificial; } 303 NextBitfieldOffsetIsValidFieldInfo304 bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const { 305 // Any subsequent bitfields must not overlap and must be at a higher 306 // bit offset than any previous bitfield + size. 307 return (bit_size + bit_offset) <= next_bit_offset; 308 } 309 310 /// Returns the offset in bits of where the storage this field 311 /// occupies ends. GetFieldEndFieldInfo312 uint64_t GetFieldEnd() const { return bit_size + bit_offset; } 313 SetEffectiveFieldEndFieldInfo314 void SetEffectiveFieldEnd(uint64_t val) { effective_field_end = val; } 315 316 /// If this field was folded into storage of a previous field, 317 /// returns the offset in bits of where that storage ends. Otherwise, 318 /// returns the regular field end (see \ref GetFieldEnd). GetEffectiveFieldEndFieldInfo319 uint64_t GetEffectiveFieldEnd() const { 320 return effective_field_end.value_or(GetFieldEnd()); 321 } 322 }; 323 324 /// Parsed form of all attributes that are relevant for parsing type members. 325 struct MemberAttributes { 326 explicit MemberAttributes( 327 const lldb_private::plugin::dwarf::DWARFDIE &die, 328 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 329 lldb::ModuleSP module_sp); 330 const char *name = nullptr; 331 /// Indicates how many bits into the word (according to the host endianness) 332 /// the low-order bit of the field starts. Can be negative. 333 int64_t bit_offset = 0; 334 /// Indicates the size of the field in bits. 335 size_t bit_size = 0; 336 uint64_t data_bit_offset = UINT64_MAX; 337 lldb::AccessType accessibility = lldb::eAccessNone; 338 std::optional<uint64_t> byte_size; 339 std::optional<lldb_private::plugin::dwarf::DWARFFormValue> const_value_form; 340 lldb_private::plugin::dwarf::DWARFFormValue encoding_form; 341 /// Indicates the byte offset of the word from the base address of the 342 /// structure. 343 uint32_t member_byte_offset = UINT32_MAX; 344 bool is_artificial = false; 345 bool is_declaration = false; 346 }; 347 348 /// Returns 'true' if we should create an unnamed bitfield 349 /// and add it to the parser's current AST. 350 /// 351 /// \param[in] last_field_info FieldInfo of the previous DW_TAG_member 352 /// we parsed. 353 /// \param[in] last_field_end Offset (in bits) where the last parsed field 354 /// ended. 355 /// \param[in] this_field_info FieldInfo of the current DW_TAG_member 356 /// being parsed. 357 /// \param[in] layout_info Layout information of all decls parsed by the 358 /// current parser. 359 bool ShouldCreateUnnamedBitfield( 360 FieldInfo const &last_field_info, uint64_t last_field_end, 361 FieldInfo const &this_field_info, 362 lldb_private::ClangASTImporter::LayoutInfo const &layout_info) const; 363 364 /// Tries to detect whether \ref class_clang_type contained an unnamed 365 /// bit-field between \ref previous_field and \ref current_field, and if 366 /// so, adds a clang::FieldDecl representing that bit-field to 367 /// \ref class_clang_type. 368 /// 369 /// This is necessary because Clang (and GCC) doesn't emit a DW_TAG_member 370 /// entry for unnamed bit-fields. So we derive it (with some exceptions), 371 /// by checking whether there is a gap between where the storage of a 372 /// DW_TAG_member ended and the subsequent DW_TAG_member began. 373 /// 374 /// \param[in,out] layout_info Layout information of all decls parsed by the 375 /// current parser. Will contain an entry for 376 /// the unnamed bit-field if this function created 377 /// one. 378 /// 379 /// \param[in] class_clang_type The RecordType to which the unnamed bit-field 380 /// will be added (if any). 381 /// 382 /// \param[in] previous_field FieldInfo of the previous DW_TAG_member 383 /// we parsed. 384 /// 385 /// \param[in] current_field FieldInfo of the current DW_TAG_member 386 /// being parsed. 387 /// 388 void AddUnnamedBitfieldToRecordTypeIfNeeded( 389 lldb_private::ClangASTImporter::LayoutInfo &class_layout_info, 390 const lldb_private::CompilerType &class_clang_type, 391 const FieldInfo &previous_field, const FieldInfo ¤t_field); 392 393 /// Parses a DW_TAG_APPLE_property DIE and appends the parsed data to the 394 /// list of delayed Objective-C properties. 395 /// 396 /// Note: The delayed property needs to be finalized to actually create the 397 /// property declarations in the module AST. 398 /// 399 /// \param die The DW_TAG_APPLE_property DIE that will be parsed. 400 /// \param parent_die The parent DIE. 401 /// \param class_clang_type The Objective-C class that will contain the 402 /// created property. 403 /// \param delayed_properties The list of delayed properties that the result 404 /// will be appended to. 405 void 406 ParseObjCProperty(const lldb_private::plugin::dwarf::DWARFDIE &die, 407 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 408 const lldb_private::CompilerType &class_clang_type, 409 DelayedPropertyList &delayed_properties); 410 411 void 412 ParseSingleMember(const lldb_private::plugin::dwarf::DWARFDIE &die, 413 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 414 const lldb_private::CompilerType &class_clang_type, 415 lldb::AccessType default_accessibility, 416 lldb_private::ClangASTImporter::LayoutInfo &layout_info, 417 FieldInfo &last_field_info); 418 419 /// If the specified 'die' represents a static data member, creates 420 /// a 'clang::VarDecl' for it and attaches it to specified parent 421 /// 'class_clang_type'. 422 /// 423 /// \param[in] die The member declaration we want to create a 424 /// clang::VarDecl for. 425 /// 426 /// \param[in] attrs The parsed attributes for the specified 'die'. 427 /// 428 /// \param[in] class_clang_type The parent RecordType of the static 429 /// member this function will create. 430 void CreateStaticMemberVariable( 431 const lldb_private::plugin::dwarf::DWARFDIE &die, 432 const MemberAttributes &attrs, 433 const lldb_private::CompilerType &class_clang_type); 434 435 bool CompleteRecordType(const lldb_private::plugin::dwarf::DWARFDIE &die, 436 const lldb_private::CompilerType &clang_type); 437 bool CompleteEnumType(const lldb_private::plugin::dwarf::DWARFDIE &die, 438 lldb_private::Type *type, 439 const lldb_private::CompilerType &clang_type); 440 441 lldb::TypeSP 442 ParseTypeModifier(const lldb_private::SymbolContext &sc, 443 const lldb_private::plugin::dwarf::DWARFDIE &die, 444 ParsedDWARFTypeAttributes &attrs); 445 lldb::TypeSP ParseEnum(const lldb_private::SymbolContext &sc, 446 const lldb_private::plugin::dwarf::DWARFDIE &die, 447 ParsedDWARFTypeAttributes &attrs); 448 lldb::TypeSP ParseSubroutine(const lldb_private::plugin::dwarf::DWARFDIE &die, 449 const ParsedDWARFTypeAttributes &attrs); 450 451 /// Helper function called by \ref ParseSubroutine when parsing ObjC-methods. 452 /// 453 /// \param[in] objc_method Name of the ObjC method being parsed. 454 /// 455 /// \param[in] die The DIE that represents the ObjC method being parsed. 456 /// 457 /// \param[in] clang_type The CompilerType representing the function prototype 458 /// of the ObjC method being parsed. 459 /// 460 /// \param[in] attrs DWARF attributes for \ref die. 461 /// 462 /// \param[in] is_variadic Is true iff we're parsing a variadic method. 463 /// 464 /// \returns true on success 465 bool 466 ParseObjCMethod(const lldb_private::ObjCLanguage::ObjCMethodName &objc_method, 467 const lldb_private::plugin::dwarf::DWARFDIE &die, 468 lldb_private::CompilerType clang_type, 469 const ParsedDWARFTypeAttributes &attrs, bool is_variadic); 470 471 /// Helper function called by \ref ParseSubroutine when parsing C++ methods. 472 /// 473 /// \param[in] die The DIE that represents the C++ method being parsed. 474 /// 475 /// \param[in] clang_type The CompilerType representing the function prototype 476 /// of the C++ method being parsed. 477 /// 478 /// \param[in] attrs DWARF attributes for \ref die. 479 /// 480 /// \param[in] decl_ctx_die The DIE representing the DeclContext of the C++ 481 /// method being parsed. 482 /// 483 /// \param[in] object_parameter The DIE of this subprogram's object parameter. 484 /// May be an invalid DIE for C++ static methods. 485 /// 486 /// \param[out] ignore_containing_context Will get set to true if the caller 487 /// should treat this C++ method as-if it was not a C++ method. 488 /// Currently used as a hack to work around templated C++ methods 489 /// causing class definitions to mismatch between CUs. 490 /// 491 /// \returns A pair of <bool, TypeSP>. The first element is 'true' on success. 492 /// The second element is non-null if we have previously parsed this 493 /// method (a null TypeSP does not indicate failure). 494 std::pair<bool, lldb::TypeSP> 495 ParseCXXMethod(const lldb_private::plugin::dwarf::DWARFDIE &die, 496 lldb_private::CompilerType clang_type, 497 const ParsedDWARFTypeAttributes &attrs, 498 const lldb_private::plugin::dwarf::DWARFDIE &decl_ctx_die, 499 const lldb_private::plugin::dwarf::DWARFDIE &object_parameter, 500 bool &ignore_containing_context); 501 502 lldb::TypeSP ParseArrayType(const lldb_private::plugin::dwarf::DWARFDIE &die, 503 const ParsedDWARFTypeAttributes &attrs); 504 lldb::TypeSP 505 ParsePointerToMemberType(const lldb_private::plugin::dwarf::DWARFDIE &die, 506 const ParsedDWARFTypeAttributes &attrs); 507 508 /// Parses a DW_TAG_inheritance DIE into a base/super class. 509 /// 510 /// \param die The DW_TAG_inheritance DIE to parse. 511 /// \param parent_die The parent DIE of the given DIE. 512 /// \param class_clang_type The C++/Objective-C class representing parent_die. 513 /// For an Objective-C class this method sets the super class on success. For 514 /// a C++ class this will *not* add the result as a base class. 515 /// \param default_accessibility The default accessibility that is given to 516 /// base classes if they don't have an explicit accessibility set. 517 /// \param module_sp The current Module. 518 /// \param base_classes The list of C++ base classes that will be appended 519 /// with the parsed base class on success. 520 /// \param layout_info The layout information that will be updated for C++ 521 /// base classes with the base offset. 522 void ParseInheritance( 523 const lldb_private::plugin::dwarf::DWARFDIE &die, 524 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 525 const lldb_private::CompilerType class_clang_type, 526 const lldb::AccessType default_accessibility, 527 const lldb::ModuleSP &module_sp, 528 std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes, 529 lldb_private::ClangASTImporter::LayoutInfo &layout_info); 530 531 /// Parses DW_TAG_variant_part DIE into a structure that encodes all variants 532 /// Note that this is currently being emitted by rustc and not Clang 533 /// \param die DW_TAG_variant_part DIE to parse 534 /// \param parent_die The parent DW_TAG_structure_type to parse 535 /// \param class_clang_type The Rust struct representing parent_die. 536 /// \param default_accesibility The default accessibility that is given to 537 /// base classes if they don't have an explicit accessibility set 538 /// \param layout_info The layout information that will be updated for 539 // base classes with the base offset 540 void 541 ParseRustVariantPart(lldb_private::plugin::dwarf::DWARFDIE &die, 542 const lldb_private::plugin::dwarf::DWARFDIE &parent_die, 543 const lldb_private::CompilerType &class_clang_type, 544 const lldb::AccessType default_accesibility, 545 lldb_private::ClangASTImporter::LayoutInfo &layout_info); 546 }; 547 548 /// Parsed form of all attributes that are relevant for type reconstruction. 549 /// Some attributes are relevant for all kinds of types (declaration), while 550 /// others are only meaningful to a specific type (is_virtual) 551 struct ParsedDWARFTypeAttributes { 552 explicit ParsedDWARFTypeAttributes( 553 const lldb_private::plugin::dwarf::DWARFDIE &die); 554 555 lldb::AccessType accessibility = lldb::eAccessNone; 556 bool is_artificial = false; 557 bool is_complete_objc_class = false; 558 bool is_explicit = false; 559 bool is_forward_declaration = false; 560 bool is_inline = false; 561 bool is_scoped_enum = false; 562 bool is_vector = false; 563 bool is_virtual = false; 564 bool is_objc_direct_call = false; 565 bool exports_symbols = false; 566 clang::StorageClass storage = clang::SC_None; 567 const char *mangled_name = nullptr; 568 lldb_private::ConstString name; 569 lldb_private::Declaration decl; 570 lldb_private::plugin::dwarf::DWARFFormValue abstract_origin; 571 lldb_private::plugin::dwarf::DWARFFormValue containing_type; 572 lldb_private::plugin::dwarf::DWARFFormValue signature; 573 lldb_private::plugin::dwarf::DWARFFormValue specification; 574 lldb_private::plugin::dwarf::DWARFFormValue type; 575 lldb::LanguageType class_language = lldb::eLanguageTypeUnknown; 576 std::optional<uint64_t> byte_size; 577 std::optional<uint64_t> alignment; 578 size_t calling_convention = llvm::dwarf::DW_CC_normal; 579 uint32_t bit_stride = 0; 580 uint32_t byte_stride = 0; 581 uint32_t encoding = 0; 582 583 ///< Indicates ref-qualifier of C++ member function if present. 584 ///< Is RQ_None otherwise. 585 clang::RefQualifierKind ref_qual = clang::RQ_None; 586 587 ///< Has a value if this DIE represents an enum that was declared 588 ///< with enum_extensibility. 589 std::optional<clang::EnumExtensibilityAttr::Kind> enum_kind; 590 }; 591 592 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H 593