[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGenObjC / debug-info-instancetype.m
blobc4c857cdf0cc0c9e4c2ca157b27d07154d1589ed
1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
2 // Substitute the actual type for a method returning instancetype.
3 @interface NSObject
4 + (id)alloc;
5 - (id)init;
6 - (id)retain;
7 @end
9 @interface Foo : NSObject
10 + (instancetype)defaultFoo;
11 @end
13 @implementation Foo
14 +(instancetype)defaultFoo {return 0;}
15 // CHECK: ![[FOO:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo"
16 // CHECK: !DISubprogram(name: "+[Foo defaultFoo]"
17 // CHECK-SAME:          line: [[@LINE-3]]
18 // CHECK-SAME:          type: ![[TYPE:[0-9]+]]
19 // CHECK: ![[TYPE]] = !DISubroutineType(types: ![[RESULT:[0-9]+]])
20 // CHECK: ![[RESULT]] = !{![[FOOPTR:[0-9]+]],
21 // CHECK: ![[FOOPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type
22 // CHECK-SAME:                         baseType: ![[FOO]]
23 @end
26 int main (int argc, const char *argv[])
28   Foo *foo = [Foo defaultFoo];
29   return 0;