summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-06-18 21:26:33 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-06-18 21:26:33 +0000
commite7e8fcacef233f35ad7e81083f7edd12497f6c40 (patch)
tree3826dd0fd12ab61b40a4431f641adb6852b9430d /test/PCH
parentda1f9cb8ce0e89d2848390aef985bad9e32e1ddb (diff)
downloadclang-e7e8fcacef233f35ad7e81083f7edd12497f6c40.tar.gz
clang-e7e8fcacef233f35ad7e81083f7edd12497f6c40.tar.bz2
clang-e7e8fcacef233f35ad7e81083f7edd12497f6c40.tar.xz
When declaring an ObjC interface decl with a @compatibility_alias alias name, change the class name to the "real" one.
If we have something like @class NewImage; @compatibility_alias OldImage NewImage; @class OldImage; the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage"). In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"), instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants. Fixes crash of rdar://14112291. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/objc_import.h11
-rw-r--r--test/PCH/objc_import.m15
2 files changed, 26 insertions, 0 deletions
diff --git a/test/PCH/objc_import.h b/test/PCH/objc_import.h
index 8af87ab25c..4646e16a2c 100644
--- a/test/PCH/objc_import.h
+++ b/test/PCH/objc_import.h
@@ -5,3 +5,14 @@
- (void)instMethod;
@end
+@class NewID1;
+@compatibility_alias OldID1 NewID1;
+@class OldID1;
+@class OldID1;
+
+@class NewID2;
+@compatibility_alias OldID2 NewID2;
+@class OldID2;
+@interface OldID2
+-(void)meth;
+@end
diff --git a/test/PCH/objc_import.m b/test/PCH/objc_import.m
index c7dd805b3e..724c822184 100644
--- a/test/PCH/objc_import.m
+++ b/test/PCH/objc_import.m
@@ -15,3 +15,18 @@ void func() {
xx = [TestPCH alloc];
[xx instMethod];
}
+
+// rdar://14112291
+@class NewID1;
+void foo1(NewID1 *p);
+void bar1(OldID1 *p) {
+ foo1(p);
+}
+@class NewID2;
+void foo2(NewID2 *p) {
+ [p meth];
+}
+void bar2(OldID2 *p) {
+ foo2(p);
+ [p meth];
+}