xref: /llvm-project/clang/test/CodeGenObjC/debug-property-synth.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
2//
3// Setting a breakpoint on a property should create breakpoints in
4// synthesized getters/setters.
5//
6@interface I {
7  int _p1;
8}
9@property int p1;
10@end
11
12@implementation I
13// Test that the linetable entries for the synthesized getter and
14// setter are correct.
15//
16// CHECK: define {{.*}}[I p1]
17// CHECK-NOT: ret
18// CHECK: load {{.*}}, !dbg ![[DBG1:[0-9]+]]
19//
20// CHECK: define {{.*}}[I setP1:]
21// CHECK-NOT: ret
22// CHECK: load {{.*}}, !dbg ![[DBG2:[0-9]+]]
23//
24// CHECK: !DISubprogram(name: "-[I p1]",{{.*}} line: [[@LINE+4]],{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
25// CHECK: ![[DBG1]] = !DILocation(line: [[@LINE+3]],
26// CHECK: !DISubprogram(name: "-[I setP1:]",{{.*}} line: [[@LINE+2]],{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
27// CHECK: ![[DBG2]] = !DILocation(line: [[@LINE+1]],
28@synthesize p1 = _p1;
29@end
30
31int main(void) {
32  I *myi;
33  myi.p1 = 2;
34  return myi.p1;
35}
36