xref: /llvm-project/clang/test/CodeGenObjC/debug-info-instancetype.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
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
8
9@interface Foo : NSObject
10+ (instancetype)defaultFoo;
11@end
12
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
24
25
26int main (int argc, const char *argv[])
27{
28  Foo *foo = [Foo defaultFoo];
29  return 0;
30}
31