@@ -2925,15 +2925,7 @@ void DWARFASTParserClang::ParseSingleMember(
2925
2925
const uint64_t parent_bit_size =
2926
2926
parent_byte_size == UINT64_MAX ? UINT64_MAX : parent_byte_size * 8 ;
2927
2927
2928
- // FIXME: Remove the workarounds below and make this const.
2929
- MemberAttributes attrs (die, parent_die, module_sp);
2930
-
2931
- const bool class_is_objc_object_or_interface =
2932
- TypeSystemClang::IsObjCObjectOrInterfaceType (class_clang_type);
2933
-
2934
- // FIXME: Make Clang ignore Objective-C accessibility for expressions
2935
- if (class_is_objc_object_or_interface)
2936
- attrs.accessibility = eAccessNone;
2928
+ const MemberAttributes attrs (die, parent_die, module_sp);
2937
2929
2938
2930
// Handle static members, which are typically members without
2939
2931
// locations. However, GCC doesn't emit DW_AT_data_member_location
@@ -2948,13 +2940,13 @@ void DWARFASTParserClang::ParseSingleMember(
2948
2940
if (attrs.member_byte_offset == UINT32_MAX &&
2949
2941
attrs.data_bit_offset == UINT64_MAX && attrs.is_declaration ) {
2950
2942
Type *var_type = die.ResolveTypeUID (attrs.encoding_form .Reference ());
2951
-
2952
2943
if (var_type) {
2953
- if (attrs.accessibility == eAccessNone)
2954
- attrs.accessibility = eAccessPublic;
2944
+ const auto accessibility = attrs.accessibility == eAccessNone
2945
+ ? eAccessPublic
2946
+ : attrs.accessibility ;
2955
2947
CompilerType ct = var_type->GetForwardCompilerType ();
2956
2948
clang::VarDecl *v = TypeSystemClang::AddVariableToRecordType (
2957
- class_clang_type, attrs.name , ct, attrs. accessibility );
2949
+ class_clang_type, attrs.name , ct, accessibility);
2958
2950
if (!v) {
2959
2951
LLDB_LOG (log, " Failed to add variable to the record type" );
2960
2952
return ;
@@ -3010,8 +3002,9 @@ void DWARFASTParserClang::ParseSingleMember(
3010
3002
const uint64_t word_width = 32 ;
3011
3003
CompilerType member_clang_type = member_type->GetLayoutCompilerType ();
3012
3004
3013
- if (attrs.accessibility == eAccessNone)
3014
- attrs.accessibility = default_accessibility;
3005
+ const auto accessibility = attrs.accessibility == eAccessNone
3006
+ ? default_accessibility
3007
+ : attrs.accessibility ;
3015
3008
3016
3009
uint64_t field_bit_offset = (attrs.member_byte_offset == UINT32_MAX
3017
3010
? 0
@@ -3025,12 +3018,13 @@ void DWARFASTParserClang::ParseSingleMember(
3025
3018
if (attrs.data_bit_offset != UINT64_MAX) {
3026
3019
this_field_info.bit_offset = attrs.data_bit_offset ;
3027
3020
} else {
3028
- if (!attrs.byte_size )
3029
- attrs.byte_size = member_type->GetByteSize (nullptr );
3021
+ auto byte_size = attrs.byte_size ;
3022
+ if (!byte_size)
3023
+ byte_size = member_type->GetByteSize (nullptr );
3030
3024
3031
3025
ObjectFile *objfile = die.GetDWARF ()->GetObjectFile ();
3032
3026
if (objfile->GetByteOrder () == eByteOrderLittle) {
3033
- this_field_info.bit_offset += attrs. byte_size .value_or (0 ) * 8 ;
3027
+ this_field_info.bit_offset += byte_size.value_or (0 ) * 8 ;
3034
3028
this_field_info.bit_offset -= (attrs.bit_offset + attrs.bit_size );
3035
3029
} else {
3036
3030
this_field_info.bit_offset += attrs.bit_offset ;
@@ -3069,7 +3063,7 @@ void DWARFASTParserClang::ParseSingleMember(
3069
3063
// unnamed bitfields if we have a new enough clang.
3070
3064
bool detect_unnamed_bitfields = true ;
3071
3065
3072
- if (class_is_objc_object_or_interface )
3066
+ if (TypeSystemClang::IsObjCObjectOrInterfaceType (class_clang_type) )
3073
3067
detect_unnamed_bitfields =
3074
3068
die.GetCU ()->Supports_unnamed_objc_bitfields ();
3075
3069
@@ -3101,7 +3095,7 @@ void DWARFASTParserClang::ParseSingleMember(
3101
3095
class_clang_type, llvm::StringRef (),
3102
3096
m_ast.GetBuiltinTypeForEncodingAndBitSize (eEncodingSint,
3103
3097
word_width),
3104
- attrs. accessibility , unnamed_field_info->bit_size );
3098
+ accessibility, unnamed_field_info->bit_size );
3105
3099
3106
3100
layout_info.field_offsets .insert (std::make_pair (
3107
3101
unnamed_bitfield_decl, unnamed_field_info->bit_offset ));
@@ -3171,7 +3165,7 @@ void DWARFASTParserClang::ParseSingleMember(
3171
3165
TypeSystemClang::RequireCompleteType (member_clang_type);
3172
3166
3173
3167
clang::FieldDecl *field_decl = TypeSystemClang::AddFieldToRecordType (
3174
- class_clang_type, attrs.name , member_clang_type, attrs. accessibility ,
3168
+ class_clang_type, attrs.name , member_clang_type, accessibility,
3175
3169
attrs.bit_size );
3176
3170
3177
3171
m_ast.SetMetadataAsUserID (field_decl, die.GetID ());
0 commit comments