Skip to content

Conversation

@Michael137
Copy link
Member

There's a couple of tests like this.

This patch series renames these to something more descriptive and adjusts the tests to check IR. Currently the tests check raw assembly output (not even dwarfdump). Which most likely hid some bugs around property debug-info.

@llvmbot llvmbot added clang Clang issues not falling into any other category lldb labels Oct 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 27, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

There's a couple of tests like this.

This patch series renames these to something more descriptive and adjusts the tests to check IR. Currently the tests check raw assembly output (not even dwarfdump). Which most likely hid some bugs around property debug-info.


Full diff: https://github.com/llvm/llvm-project/pull/165286.diff

5 Files Affected:

  • (added) clang/test/DebugInfo/ObjC/property-basic.m (+20)
  • (removed) clang/test/DebugInfo/ObjC/property.m (-15)
  • (added) lldb/test/API/lang/objc/synthesized-property-accessor/Makefile (+4)
  • (added) lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py (+30)
  • (added) lldb/test/API/lang/objc/synthesized-property-accessor/main.m (+14)
diff --git a/clang/test/DebugInfo/ObjC/property-basic.m b/clang/test/DebugInfo/ObjC/property-basic.m
new file mode 100644
index 0000000000000..65e1d7a6a9b1f
--- /dev/null
+++ b/clang/test/DebugInfo/ObjC/property-basic.m
@@ -0,0 +1,20 @@
+// Checks basic debug-info generation for property. Makes sure we
+// create a DIObjCProperty for the synthesized property.
+
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK: !DIObjCProperty(name: "p1"
+// CHECK-SAME:            attributes: 2316
+// CHECK-SAME:            type: ![[P1_TYPE:[0-9]+]]
+//
+// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
+
+@interface I1 {
+int p1;
+}
+@property int p1;
+@end
+
+@implementation I1
+@synthesize p1;
+@end
diff --git a/clang/test/DebugInfo/ObjC/property.m b/clang/test/DebugInfo/ObjC/property.m
deleted file mode 100644
index ca013b24be421..0000000000000
--- a/clang/test/DebugInfo/ObjC/property.m
+++ /dev/null
@@ -1,15 +0,0 @@
-// FIXME: Check IR rather than asm, then triple is not needed.
-// RUN: %clang_cc1 -triple %itanium_abi_triple -S -debug-info-kind=limited %s -o - | FileCheck %s
-
-// CHECK: AT_APPLE_property_name
-// CHECK: AT_APPLE_property_attribute
-// CHECK: AT_APPLE_property
-@interface I1 {
-int p1;
-}
-@property int p1;
-@end
-
-@implementation I1
-@synthesize p1;
-@end
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
new file mode 100644
index 0000000000000..89e6e796b1970
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+LDFLAGS := -lobjc
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
new file mode 100644
index 0000000000000..7686ab48e1189
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
@@ -0,0 +1,30 @@
+"""
+Test debug-info parsing of synthesized Objective-C properties.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestSynthesizedPropertyAccessor(TestBase):
+    def test(self):
+        self.build()
+
+        (target, _, _, _) = lldbutil.run_to_source_breakpoint(
+            self, "return f.fooProp", lldb.SBFileSpec("main.m")
+        )
+
+        getters = target.FindFunctions("-[Foo fooProp]", lldb.eFunctionNameTypeSelector)
+        self.assertEqual(len(getters), 1)
+        getter = getters[0].function.GetType()
+        self.assertTrue(getter)
+        self.assertEqual(getter.GetDisplayTypeName(), "int ()")
+
+        setters = target.FindFunctions(
+            "-[Foo setFooProp:]", lldb.eFunctionNameTypeSelector
+        )
+        self.assertEqual(len(setters), 1)
+        setter = setters[0].function.GetType()
+        self.assertTrue(setter)
+        self.assertEqual(setter.GetDisplayTypeName(), "void (id)")
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/main.m b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
new file mode 100644
index 0000000000000..418616267f9ae
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
@@ -0,0 +1,14 @@
+#import <Foundation/Foundation.h>
+
+@interface Foo : NSObject
+@property(readwrite) int fooProp;
+@end
+
+@implementation Foo
+@end
+
+int main() {
+  Foo *f = [Foo new];
+  [f setFooProp:10];
+  return f.fooProp;
+}

…LVM IR

There's a couple of tests like this.

This patch series renames these to something more descriptive and adjusts the tests to check IR. Currently the tests check raw assembly output (not even dwarfdump). Which most likely hid some bugs around property debug-info.
@Michael137 Michael137 force-pushed the clang/debuginfo-objc-property-test-1 branch from 169a8ee to 65e4b36 Compare October 27, 2025 17:35
@Michael137 Michael137 merged commit cc868f6 into llvm:main Oct 27, 2025
10 checks passed
@Michael137 Michael137 deleted the clang/debuginfo-objc-property-test-1 branch October 27, 2025 19:06
dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.
Michael137 added a commit to swiftlang/llvm-project that referenced this pull request Nov 4, 2025
…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.

(cherry picked from commit cc868f6)
Michael137 added a commit to swiftlang/llvm-project that referenced this pull request Nov 5, 2025
…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.

(cherry picked from commit cc868f6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category lldb

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants