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