summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-12-27 22:14:15 +0000
committerNico Weber <nicolasweber@gmx.de>2014-12-27 22:14:15 +0000
commitff4b35e6e73ee97bd1437908ce657c62b8a179e5 (patch)
tree1647c8f0c96367351bcec1d6f5623c2f615f27b0 /clang/test/SemaObjC
parent6e3a582809efea34253dfdfd7327c89c3f9f4800 (diff)
downloadbcm5719-llvm-ff4b35e6e73ee97bd1437908ce657c62b8a179e5.tar.gz
bcm5719-llvm-ff4b35e6e73ee97bd1437908ce657c62b8a179e5.zip
Objective-C: Serialize "more than one decl" state of ObjCMethodList.
This fixes PR21587, what r221933 fixed for regular programs is now also fixed for decls coming from PCH files. Use another bit from the count/bits uint16_t for storing the "more than one decl" bit. This reduces the number of bits for the count from 14 to 13. The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits should still be plenty. Since this changes the meaning of a serialized bit pattern, also increase clang::serialization::VERSION_MAJOR. Storing the "more than one decl" state of only the first overload isn't quite correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at the state of the first overload so it's good enough for now. llvm-svn: 224892
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/attr-deprecated-pch.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/attr-deprecated-pch.m b/clang/test/SemaObjC/attr-deprecated-pch.m
new file mode 100644
index 00000000000..2b48aea379a
--- /dev/null
+++ b/clang/test/SemaObjC/attr-deprecated-pch.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -DBOTH -verify %s
+// If the decls come from a pch, the behavior shouldn't change:
+// RUN: %clang_cc1 -x objective-c-header %s -emit-pch -o %t
+// RUN: %clang_cc1 -DUSES -include-pch %t -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// The slightly strange ifdefs are so that the command that builds the gch file
+// doesn't need any -D switches, for these would get embedded in the gch.
+
+#ifndef USES
+@interface Interface1
+- (void)partiallyUnavailableMethod;
+@end
+@interface Interface2
+- (void)partiallyUnavailableMethod __attribute__((unavailable));
+@end
+#endif
+
+#if defined(USES) || defined(BOTH)
+void f(id a) {
+ [a partiallyUnavailableMethod]; // no warning, `a` could be an Interface1.
+}
+#endif
OpenPOWER on IntegriCloud