aboutsummaryrefslogtreecommitdiff
path: root/clang/test/DebugInfo/ObjC
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/DebugInfo/ObjC')
-rw-r--r--clang/test/DebugInfo/ObjC/property-2.m18
-rw-r--r--clang/test/DebugInfo/ObjC/property-auto-synth.m13
-rw-r--r--clang/test/DebugInfo/ObjC/property-basic.m20
-rw-r--r--clang/test/DebugInfo/ObjC/property-explicit-accessors.m34
-rw-r--r--clang/test/DebugInfo/ObjC/property-explicit-ivar.m22
-rw-r--r--clang/test/DebugInfo/ObjC/property-synthesized-accessors.m63
-rw-r--r--clang/test/DebugInfo/ObjC/property.m15
-rw-r--r--clang/test/DebugInfo/ObjC/property2.m15
-rw-r--r--clang/test/DebugInfo/ObjC/property4.m18
-rw-r--r--clang/test/DebugInfo/ObjC/property5.m33
10 files changed, 152 insertions, 99 deletions
diff --git a/clang/test/DebugInfo/ObjC/property-2.m b/clang/test/DebugInfo/ObjC/property-2.m
deleted file mode 100644
index f152131..0000000
--- a/clang/test/DebugInfo/ObjC/property-2.m
+++ /dev/null
@@ -1,18 +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 -x objective-c < %s | grep DW_AT_name
-@interface Foo {
- int i;
-}
-@property int i;
-@end
-
-@implementation Foo
-@synthesize i;
-@end
-
-int bar(Foo *f) {
- int i = 1;
- f.i = 2;
- i = f.i;
- return i;
-}
diff --git a/clang/test/DebugInfo/ObjC/property-auto-synth.m b/clang/test/DebugInfo/ObjC/property-auto-synth.m
new file mode 100644
index 0000000..5e961d4
--- /dev/null
+++ b/clang/test/DebugInfo/ObjC/property-auto-synth.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK-NOT: setter
+// CHECK-NOT: getter
+
+@interface I1
+@property int p1;
+@end
+
+@implementation I1
+@end
+
+void foo(I1 *ptr) {}
diff --git a/clang/test/DebugInfo/ObjC/property-basic.m b/clang/test/DebugInfo/ObjC/property-basic.m
new file mode 100644
index 0000000..65e1d7a
--- /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-explicit-accessors.m b/clang/test/DebugInfo/ObjC/property-explicit-accessors.m
new file mode 100644
index 0000000..86eade6
--- /dev/null
+++ b/clang/test/DebugInfo/ObjC/property-explicit-accessors.m
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK: !DIObjCProperty(name: "baseInt"
+// CHECK-SAME: setter: "mySetBaseInt:"
+// CHECK-SAME: getter: "myGetBaseInt"
+// CHECK-SAME: attributes: 2446
+// CHECK-SAME: type: ![[P1_TYPE:[0-9]+]]
+//
+// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
+
+@interface BaseClass2
+{
+ int _baseInt;
+}
+- (int) myGetBaseInt;
+- (void) mySetBaseInt: (int) in_int;
+@property(getter=myGetBaseInt,setter=mySetBaseInt:) int baseInt;
+@end
+
+@implementation BaseClass2
+
+- (int) myGetBaseInt
+{
+ return _baseInt;
+}
+
+- (void) mySetBaseInt: (int) in_int
+{
+ _baseInt = 2 * in_int;
+}
+@end
+
+
+void foo(BaseClass2 *ptr) {}
diff --git a/clang/test/DebugInfo/ObjC/property-explicit-ivar.m b/clang/test/DebugInfo/ObjC/property-explicit-ivar.m
new file mode 100644
index 0000000..5092e23
--- /dev/null
+++ b/clang/test/DebugInfo/ObjC/property-explicit-ivar.m
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
+
+// CHECK: ![[BASE_PROP:[0-9]+]] = !DIObjCProperty(name: "base"
+// CHECK-SAME: attributes: 2316
+// CHECK-SAME: type: ![[P1_TYPE:[0-9]+]]
+//
+// CHECK: ![[P1_TYPE]] = !DIBasicType(name: "int"
+//
+// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_customIvar"
+// CHECK-SAME: extraData: ![[BASE_PROP]]
+
+@interface C {
+ int _customIvar;
+}
+@property int base;
+@end
+
+@implementation C
+@synthesize base = _customIvar;
+@end
+
+void foo(C *cptr) {}
diff --git a/clang/test/DebugInfo/ObjC/property-synthesized-accessors.m b/clang/test/DebugInfo/ObjC/property-synthesized-accessors.m
new file mode 100644
index 0000000..d2e2dba
--- /dev/null
+++ b/clang/test/DebugInfo/ObjC/property-synthesized-accessors.m
@@ -0,0 +1,63 @@
+// Test that synthesized accessors get treated like regular method declarations/definitions.
+// I.e.:
+// 1. explicitly passed parameter are not marked artificial.
+// 2. Each property accessor has a method declaration and definition.
+
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -dwarf-version=5 -debug-info-kind=limited %s -o - | FileCheck %s --implicit-check-not "DIFlagArtificial"
+
+@interface Foo
+@property int p1;
+@end
+
+@implementation Foo
+@end
+
+int main(void) {
+ Foo *f;
+ f.p1 = 2;
+ return f.p1;
+}
+
+// CHECK: ![[P1_TYPE:[0-9]+]] = !DIBasicType(name: "int"
+// CHECK: ![[GETTER_DECL:[0-9]+]] = !DISubprogram(name: "-[Foo p1]"
+// CHECK-SAME: type: ![[GETTER_TYPE:[0-9]+]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagPrototyped
+// CHECK-SAME: spFlags: DISPFlagLocalToUnit)
+
+// CHECK: ![[GETTER_TYPE]] = !DISubroutineType(types: ![[GETTER_PARAMS:[0-9]+]])
+// CHECK: ![[GETTER_PARAMS]] = !{![[P1_TYPE]], ![[ID_TYPE:[0-9]+]], ![[SEL_TYPE:[0-9]+]]}
+// CHECK: ![[ID_TYPE]] = !DIDerivedType(tag: DW_TAG_pointer_type
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer)
+// CHECK: ![[SEL_TYPE]] = !DIDerivedType(tag: DW_TAG_typedef, name: "SEL"
+// CHECK-SAME: flags: DIFlagArtificial)
+
+// CHECK: ![[SETTER_DECL:[0-9]+]] = !DISubprogram(name: "-[Foo setP1:]"
+// CHECK-SAME: type: ![[SETTER_TYPE:[0-9]+]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagPrototyped
+// CHECK-SAME: spFlags: DISPFlagLocalToUnit)
+// CHECK: ![[SETTER_TYPE]] = !DISubroutineType(types: ![[SETTER_PARAMS:[0-9]+]])
+// CHECK: ![[SETTER_PARAMS]] = !{null, ![[ID_TYPE]], ![[SEL_TYPE]], ![[P1_TYPE]]}
+
+// CHECK: ![[GETTER_DEF:[0-9]+]] = distinct !DISubprogram(name: "-[Foo p1]"
+// CHECK-SAME: type: ![[GETTER_TYPE]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagPrototyped
+// CHECK-SAME: spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
+// CHECK-SAME: declaration: ![[GETTER_DECL]]
+
+// CHECK: !DILocalVariable(name: "self", arg: 1, scope: ![[GETTER_DEF]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer)
+//
+// CHECK: !DILocalVariable(name: "_cmd", arg: 2, scope: ![[GETTER_DEF]],
+// CHECK-SAME: flags: DIFlagArtificial)
+
+// CHECK: ![[SETTER_DEF:[0-9]+]] = distinct !DISubprogram(name: "-[Foo setP1:]",
+// CHECK-SAME: type: ![[SETTER_TYPE]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagPrototyped
+// CHECK-SAME: spFlags: DISPFlagLocalToUnit | DISPFlagDefinition
+// CHECK-SAME: declaration: ![[SETTER_DECL]]
+
+// CHECK: !DILocalVariable(name: "self", arg: 1, scope: ![[SETTER_DEF]]
+// CHECK-SAME: flags: DIFlagArtificial | DIFlagObjectPointer
+// CHECK: !DILocalVariable(name: "_cmd", arg: 2, scope: ![[SETTER_DEF]]
+// CHECK-SAME: flags: DIFlagArtificial
+// CHECK: !DILocalVariable(name: "p1", arg: 3, scope: ![[SETTER_DEF]]
diff --git a/clang/test/DebugInfo/ObjC/property.m b/clang/test/DebugInfo/ObjC/property.m
deleted file mode 100644
index ca013b2..0000000
--- 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/clang/test/DebugInfo/ObjC/property2.m b/clang/test/DebugInfo/ObjC/property2.m
deleted file mode 100644
index 7e0a5e9..0000000
--- a/clang/test/DebugInfo/ObjC/property2.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
-@interface C {
- int _base;
-}
-@property int base;
-@end
-
-@implementation C
-@synthesize base = _base;
-@end
-
-void foo(C *cptr) {}
diff --git a/clang/test/DebugInfo/ObjC/property4.m b/clang/test/DebugInfo/ObjC/property4.m
deleted file mode 100644
index 1f489f2..0000000
--- a/clang/test/DebugInfo/ObjC/property4.m
+++ /dev/null
@@ -1,18 +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-NOT: AT_APPLE_property_getter
-// CHECK-NOT: AT_APPLE_property_setter
-// CHECK: AT_APPLE_property_attribute
-// CHECK: AT_APPLE_property
-
-
-@interface I1
-@property int p1;
-@end
-
-@implementation I1
-@end
-
-void foo(I1 *ptr) {}
diff --git a/clang/test/DebugInfo/ObjC/property5.m b/clang/test/DebugInfo/ObjC/property5.m
deleted file mode 100644
index 8b70f1f..0000000
--- a/clang/test/DebugInfo/ObjC/property5.m
+++ /dev/null
@@ -1,33 +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_getter
-// CHECK: AT_APPLE_property_setter
-// CHECK: AT_APPLE_property_attribute
-// CHECK: AT_APPLE_property
-
-@interface BaseClass2
-{
- int _baseInt;
-}
-- (int) myGetBaseInt;
-- (void) mySetBaseInt: (int) in_int;
-@property(getter=myGetBaseInt,setter=mySetBaseInt:) int baseInt;
-@end
-
-@implementation BaseClass2
-
-- (int) myGetBaseInt
-{
- return _baseInt;
-}
-
-- (void) mySetBaseInt: (int) in_int
-{
- _baseInt = 2 * in_int;
-}
-@end
-
-
-void foo(BaseClass2 *ptr) {}