summaryrefslogtreecommitdiff
path: root/test/CodeGenObjC
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2013-05-10 21:08:31 +0000
committerAdrian Prantl <aprantl@apple.com>2013-05-10 21:08:31 +0000
commit566a9c3680d9960bb0eb6acf33507251cc13a8d8 (patch)
tree526c528eb24b39820490fc0549a687e566f74e61 /test/CodeGenObjC
parent9cbcab88d441761b5c5d7811c4d0c205250991bf (diff)
downloadclang-566a9c3680d9960bb0eb6acf33507251cc13a8d8.tar.gz
ObjC debug info: Substitute the class type for methods that return
a related type (e.g., if they use the instancetype keyword). rdar://problem/13359718 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r--test/CodeGenObjC/debug-info-instancetype.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGenObjC/debug-info-instancetype.m b/test/CodeGenObjC/debug-info-instancetype.m
new file mode 100644
index 0000000000..7275b63d17
--- /dev/null
+++ b/test/CodeGenObjC/debug-info-instancetype.m
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+// rdar://problem/13359718
+// Substitute the actual type for a method returning instancetype.
+@interface NSObject
++ (id)alloc;
+- (id)init;
+- (id)retain;
+@end
+
+@interface Foo : NSObject
++ (instancetype)defaultFoo;
+@end
+
+@implementation Foo
++(instancetype)defaultFoo {return 0;}
+// CHECK: ![[FOO:[0-9]+]] = metadata {{.*}}; [ DW_TAG_structure_type ] [Foo]
+// CHECK: metadata !"+[Foo defaultFoo]", metadata !"", i32 [[@LINE-2]], metadata ![[TYPE:[0-9]+]]
+// CHECK: ![[TYPE]] = {{.*}} metadata ![[RESULT:[0-9]+]], i32 {{.*}}, i32 {{.*}}} ; [ DW_TAG_subroutine_type ]
+// CHECK: ![[RESULT]] = metadata !{metadata ![[FOO]],
+@end
+
+
+int main (int argc, const char *argv[])
+{
+ Foo *foo = [Foo defaultFoo];
+ return 0;
+}