[llvm] 10fbbb6 - [llvm][DebugInfo][ObjC] Make sure we link backing ivars to their DW_TAG_APPLE_property (#165409)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 31 03:26:03 PDT 2025
Author: Michael Buch
Date: 2025-10-31T10:25:58Z
New Revision: 10fbbb62ceb688a3ed0f6dfd95a8b545aa39ca74
URL: https://github.com/llvm/llvm-project/commit/10fbbb62ceb688a3ed0f6dfd95a8b545aa39ca74
DIFF: https://github.com/llvm/llvm-project/commit/10fbbb62ceb688a3ed0f6dfd95a8b545aa39ca74.diff
LOG: [llvm][DebugInfo][ObjC] Make sure we link backing ivars to their DW_TAG_APPLE_property (#165409)
Depends on:
* https://github.com/llvm/llvm-project/pull/165373
When an Objective-C property has a backing ivar, we would previously not
add a `DW_AT_APPLE_property` to the ivar's `DW_TAG_member`. This is what
was intended based on the [Objective-C DebugInfo
docs](https://github.com/llvm/llvm-project/blob/main/llvm/docs/SourceLevelDebugging.rst#proposal)
but is not what LLVM currently generates.
LLDB currently doesn't ever try linking the `ObjCPropertyDecl`s to their
`ObjCIvarDecl`s, but if we wanted to, this debug-info patch is a
pre-requisite.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/Generic/objc-property.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 555c56fd322bb..b16e131529ac3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1120,7 +1120,7 @@ void DwarfUnit::constructTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
constructMemberDIE(Buffer, DDTy);
}
} else if (auto *Property = dyn_cast<DIObjCProperty>(Element)) {
- DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer);
+ DIE &ElemDie = createAndAddDIE(Property->getTag(), Buffer, Property);
StringRef PropertyName = Property->getName();
addString(ElemDie, dwarf::DW_AT_APPLE_property_name, PropertyName);
if (Property->getType())
diff --git a/llvm/test/DebugInfo/Generic/objc-property.ll b/llvm/test/DebugInfo/Generic/objc-property.ll
index 007d1fe698b30..1ee792941bcbb 100644
--- a/llvm/test/DebugInfo/Generic/objc-property.ll
+++ b/llvm/test/DebugInfo/Generic/objc-property.ll
@@ -5,33 +5,33 @@
; CHECK: DW_TAG_structure_type
; CHECK: DW_AT_name ("Foo")
;
-; CHECK: DW_TAG_APPLE_property
+; CHECK: 0x[[AUTO_SYNTH:[0-9a-f]+]]: DW_TAG_APPLE_property
; CHECK: DW_AT_APPLE_property_name ("autoSynthProp")
; CHECK: DW_AT_APPLE_property_attribute
; CHECK-SAME: DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite,
; CHECK-SAME: DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained
;
-; CHECK: DW_TAG_APPLE_property
+; CHECK: 0x[[SYNTH:[0-9a-f]+]]: DW_TAG_APPLE_property
; CHECK: DW_AT_APPLE_property_name ("synthProp")
; CHECK: DW_AT_APPLE_property_attribute
; CHECK-SAME: DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite,
; CHECK-SAME: DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained
;
-; CHECK: DW_TAG_APPLE_property
+; CHECK: 0x[[GET:[0-9a-f]+]]: DW_TAG_APPLE_property
; CHECK: DW_AT_APPLE_property_name ("customGetterProp")
; CHECK: DW_AT_APPLE_property_getter ("customGetter")
; CHECK: DW_AT_APPLE_property_attribute
; CHECK-SAME: DW_APPLE_PROPERTY_getter, DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite,
; CHECK-SAME: DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained
;
-; CHECK: DW_TAG_APPLE_property
+; CHECK: 0x[[SET:[0-9a-f]+]]: DW_TAG_APPLE_property
; CHECK: DW_AT_APPLE_property_name ("customSetterProp")
; CHECK: DW_AT_APPLE_property_setter ("customSetter:")
; CHECK: DW_AT_APPLE_property_attribute
; CHECK-SAME: DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite,
; CHECK-SAME: DW_APPLE_PROPERTY_setter, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained
;
-; CHECK: DW_TAG_APPLE_property
+; CHECK: 0x[[ACCESSORS:[0-9a-f]+]]: DW_TAG_APPLE_property
; CHECK: DW_AT_APPLE_property_name ("customAccessorsProp")
; CHECK: DW_AT_APPLE_property_getter ("customGetter")
; CHECK: DW_AT_APPLE_property_setter ("customSetter:")
@@ -39,15 +39,21 @@
; CHECK-SAME: DW_APPLE_PROPERTY_getter, DW_APPLE_PROPERTY_assign, DW_APPLE_PROPERTY_readwrite,
; CHECK-SAME: DW_APPLE_PROPERTY_setter, DW_APPLE_PROPERTY_atomic, DW_APPLE_PROPERTY_unsafe_unretained
;
-; FIXME: missing link between DW_TAG_member and the associated DW_TAG_APPLE_property
; CHECK: DW_TAG_member
-; CHECK-NOT: DW_AT_APPLE_property
+; CHECK: DW_AT_name ("someBackingIvar")
+; CHECK: DW_AT_APPLE_property (0x[[SYNTH]] "synthProp")
+;
; CHECK: DW_TAG_member
-; CHECK-NOT: DW_AT_APPLE_property
+; CHECK: DW_AT_name ("_autoSynthProp")
+; CHECK: DW_AT_APPLE_property (0x[[AUTO_SYNTH]] "autoSynthProp")
+;
; CHECK: DW_TAG_member
-; CHECK-NOT: DW_AT_APPLE_property
+; CHECK: DW_AT_name ("_customGetterProp")
+; CHECK: DW_AT_APPLE_property (0x[[GET]] "customGetterProp")
+;
; CHECK: DW_TAG_member
-; CHECK-NOT: DW_AT_APPLE_property
+; CHECK: DW_AT_name ("_customSetterProp")
+; CHECK: DW_AT_APPLE_property (0x[[SET]] "customSetterProp")
!llvm.module.flags = !{!0, !1}
!llvm.dbg.cu = !{!2}
More information about the llvm-commits
mailing list