================
@@ -0,0 +1,41 @@
+// Verifies that, in addition to the legacy DIObjCProperty node, Clang also
+// emits a new DIProperty node whose backing_storage points at the ivar a
+// synthesized property forwards to. Covers the three ways a property can be
+// backed by an ivar:
+//   1. declaredBacking   - @synthesize with a custom ivar name that IS
+//                           declared in the @interface.
+//   2. undeclaredBacking - @synthesize with a custom ivar name that is NOT
+//                           declared; the compiler creates the ivar itself.
+//   3. implicitBacking   - no @synthesize at all; the compiler
+//                           auto-synthesizes both the accessors and a
+//                           default-named ivar (_implicitBacking).
+
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-DAG: ![[DECLARED_PROP:[0-9]+]] = !DIObjCProperty(name: 
"declaredBacking", file: !{{[0-9]+}}, line: {{[0-9]+}}, attributes: 2316, type: 
![[INT_TY:[0-9]+]])
+// CHECK-DAG: ![[UNDECLARED_PROP:[0-9]+]] = !DIObjCProperty(name: 
"undeclaredBacking", file: !{{[0-9]+}}, line: {{[0-9]+}}, attributes: 2316, 
type: ![[INT_TY]])
+// CHECK-DAG: ![[IMPLICIT_PROP:[0-9]+]] = !DIObjCProperty(name: 
"implicitBacking", file: !{{[0-9]+}}, line: {{[0-9]+}}, attributes: 2316, type: 
![[INT_TY]])
+//
+// CHECK-DAG: ![[DECLARED_IVAR:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, 
name: "_customDeclaredIvar", {{.*}}extraData: ![[DECLARED_PROP]])
+// CHECK-DAG: !DIProperty(name: "declaredBacking", file: !{{[0-9]+}}, line: 
{{[0-9]+}}, type: ![[INT_TY]], backing_storage: ![[DECLARED_IVAR]])
+//
+// CHECK-DAG: ![[UNDECLARED_IVAR:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, 
name: "_customUndeclaredIvar", {{.*}}extraData: ![[UNDECLARED_PROP]])
+// CHECK-DAG: !DIProperty(name: "undeclaredBacking", file: !{{[0-9]+}}, line: 
{{[0-9]+}}, type: ![[INT_TY]], backing_storage: ![[UNDECLARED_IVAR]])
----------------
augusto2112 wrote:

There's some documentation on llvm's testing infrastructure at 
https://llvm.org/docs/TestingGuide.html

https://github.com/llvm/llvm-project/pull/220362
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to