labath created this revision. labath added reviewers: teemperor, shafik. Herald added a subscriber: jfb. Herald added a project: LLDB.
This enables us to display the contents of atomic structs. Calling the removal of _Atomic "desugaring" is not fully correct as it does more than remove sugar, but it is the right thing to do for most of the things that we care about. We can change this back once we decide to support atomic types more comprehensively. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D71262 Files: lldb/source/Symbol/ClangASTContext.cpp lldb/test/Shell/SymbolFile/DWARF/dwarf5-atomic.s
Index: lldb/test/Shell/SymbolFile/DWARF/dwarf5-atomic.s =================================================================== --- lldb/test/Shell/SymbolFile/DWARF/dwarf5-atomic.s +++ lldb/test/Shell/SymbolFile/DWARF/dwarf5-atomic.s @@ -4,13 +4,13 @@ # RUN: %lldb %t -o "target variable integer structure" -o exit | FileCheck %s # CHECK: (_Atomic(int)) integer = 14159 -# CHECK: (_Atomic(struct_type)) structure = {} +# CHECK: (_Atomic(struct_type)) structure = (member = 71828) .data integer: .long 14159 structure: - .byte 0 + .long 71828 .section .debug_abbrev,"",@progbits .byte 1 # Abbreviation Code @@ -53,13 +53,24 @@ .byte 0 # EOM(2) .byte 5 # Abbreviation Code .byte 19 # DW_TAG_structure_type - .byte 0 # DW_CHILDREN_no + .byte 1 # DW_CHILDREN_yes .byte 3 # DW_AT_name .byte 8 # DW_FORM_string .byte 11 # DW_AT_byte_size .byte 11 # DW_FORM_data1 .byte 0 # EOM(1) .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 13 # DW_TAG_member + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 8 # DW_FORM_string + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 56 # DW_AT_data_member_location + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) .byte 0 # EOM(3) .section .debug_info,"",@progbits @@ -99,6 +110,11 @@ .Lstruct: .byte 5 # Abbrev [5] DW_TAG_structure_type .asciz "struct_type" # DW_AT_name - .byte 0 # DW_AT_byte_size + .byte 4 # DW_AT_byte_size + .byte 6 # Abbrev [6] DW_TAG_member + .asciz "member" # DW_AT_name + .long .Lint # DW_AT_type + .byte 0 # DW_AT_data_member_location + .byte 0 # End Of Children Mark .byte 0 # End Of Children Mark .Ldebug_info_end0: Index: lldb/source/Symbol/ClangASTContext.cpp =================================================================== --- lldb/source/Symbol/ClangASTContext.cpp +++ lldb/source/Symbol/ClangASTContext.cpp @@ -2476,6 +2476,11 @@ if (find(mask, type->getTypeClass()) != mask.end()) return type; switch (type->getTypeClass()) { + // This is not fully correct as _Atomic is more than sugar, but it is + // sufficient for the purposes we care about. + case clang::Type::Atomic: + type = cast<clang::AtomicType>(type)->getValueType(); + break; case clang::Type::Auto: case clang::Type::Elaborated: case clang::Type::Paren: @@ -3826,11 +3831,6 @@ ->getUnderlyingType() .getAsOpaquePtr()) .GetTypeInfo(pointee_or_element_clang_type); - case clang::Type::Atomic: - return CompilerType(this, llvm::cast<clang::AtomicType>(qual_type) - ->getValueType() - .getAsOpaquePtr()) - .GetTypeInfo(pointee_or_element_clang_type); case clang::Type::UnresolvedUsing: return 0; @@ -3947,6 +3947,7 @@ Desugar(GetQualType(type), {clang::Type::Typedef}); switch (qual_type->getTypeClass()) { + case clang::Type::Atomic: case clang::Type::Auto: case clang::Type::Elaborated: case clang::Type::Paren: @@ -4051,8 +4052,6 @@ break; case clang::Type::DeducedTemplateSpecialization: break; - case clang::Type::Atomic: - break; case clang::Type::Pipe: break; @@ -4660,6 +4659,7 @@ clang::QualType qual_type = Desugar(GetCanonicalQualType(type)); switch (qual_type->getTypeClass()) { + case clang::Type::Atomic: case clang::Type::Auto: case clang::Type::Elaborated: case clang::Type::Paren: @@ -4902,7 +4902,6 @@ case clang::Type::TemplateSpecialization: case clang::Type::DeducedTemplateSpecialization: - case clang::Type::Atomic: case clang::Type::Adjusted: case clang::Type::Pipe: break; @@ -4929,6 +4928,7 @@ clang::QualType qual_type = Desugar(GetCanonicalQualType(type)); switch (qual_type->getTypeClass()) { + case clang::Type::Atomic: case clang::Type::Auto: case clang::Type::Elaborated: case clang::Type::Paren: @@ -5042,11 +5042,6 @@ ->getUnderlyingType() .getAsOpaquePtr()) .GetFormat(); - case clang::Type::Atomic: - return CompilerType(this, llvm::cast<clang::AtomicType>(qual_type) - ->getValueType() - .getAsOpaquePtr()) - .GetFormat(); case clang::Type::DependentSizedArray: case clang::Type::DependentSizedExtVector: case clang::Type::UnresolvedUsing:
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits