@@ -570,6 +570,39 @@ ExtractDataMemberLocation(DWARFDIE const &die, DWARFFormValue const &form_value,
570570 return memberOffset.ResolveValue (nullptr ).UInt ();
571571}
572572
573+ static TypePayloadClang GetPtrAuthMofidierPayload (const DWARFDIE &die) {
574+ auto getAttr = [&](llvm::dwarf::Attribute Attr, unsigned defaultValue = 0 ) {
575+ return die.GetAttributeValueAsUnsigned (Attr, defaultValue);
576+ };
577+ const unsigned key = getAttr (DW_AT_LLVM_ptrauth_key);
578+ const bool addr_disc = getAttr (DW_AT_LLVM_ptrauth_address_discriminated);
579+ const unsigned extra = getAttr (DW_AT_LLVM_ptrauth_extra_discriminator);
580+ const bool isapointer = getAttr (DW_AT_LLVM_ptrauth_isa_pointer);
581+ const bool authenticates_null_values =
582+ getAttr (DW_AT_LLVM_ptrauth_authenticates_null_values);
583+ const unsigned authentication_mode_int = getAttr (
584+ DW_AT_LLVM_ptrauth_authentication_mode,
585+ static_cast <unsigned >(clang::PointerAuthenticationMode::SignAndAuth));
586+ clang::PointerAuthenticationMode authentication_mode =
587+ clang::PointerAuthenticationMode::SignAndAuth;
588+ if (authentication_mode_int >=
589+ static_cast <unsigned >(clang::PointerAuthenticationMode::None) &&
590+ authentication_mode_int <=
591+ static_cast <unsigned >(
592+ clang::PointerAuthenticationMode::SignAndAuth)) {
593+ authentication_mode =
594+ static_cast <clang::PointerAuthenticationMode>(authentication_mode_int);
595+ } else {
596+ die.GetDWARF ()->GetObjectFile ()->GetModule ()->ReportError (
597+ " [{0:x16}]: invalid pointer authentication mode method {1:x4}" ,
598+ die.GetOffset (), authentication_mode_int);
599+ }
600+ auto ptr_auth = clang::PointerAuthQualifier::Create (
601+ key, addr_disc, extra, authentication_mode, isapointer,
602+ authenticates_null_values);
603+ return TypePayloadClang (ptr_auth.getAsOpaqueValue ());
604+ }
605+
573606lldb::TypeSP
574607DWARFASTParserClang::ParseTypeModifier (const SymbolContext &sc,
575608 const DWARFDIE &die,
@@ -580,6 +613,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
580613 LanguageType cu_language = SymbolFileDWARF::GetLanguage (*die.GetCU ());
581614 Type::ResolveState resolve_state = Type::ResolveState::Unresolved;
582615 Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
616+ TypePayloadClang payload (GetOwningClangModule (die));
583617 TypeSP type_sp;
584618 CompilerType clang_type;
585619
@@ -677,6 +711,10 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
677711 case DW_TAG_volatile_type:
678712 encoding_data_type = Type::eEncodingIsVolatileUID;
679713 break ;
714+ case DW_TAG_LLVM_ptrauth_type:
715+ encoding_data_type = Type::eEncodingIsLLVMPtrAuthUID;
716+ payload = GetPtrAuthMofidierPayload (die);
717+ break ;
680718 case DW_TAG_atomic_type:
681719 encoding_data_type = Type::eEncodingIsAtomicUID;
682720 break ;
@@ -786,8 +824,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
786824
787825 type_sp = dwarf->MakeType (die.GetID (), attrs.name , attrs.byte_size , nullptr ,
788826 attrs.type .Reference ().GetID (), encoding_data_type,
789- &attrs.decl , clang_type, resolve_state,
790- TypePayloadClang (GetOwningClangModule (die)));
827+ &attrs.decl , clang_type, resolve_state, payload);
791828
792829 dwarf->GetDIEToType ()[die.GetDIE ()] = type_sp.get ();
793830 return type_sp;
0 commit comments