summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2015-04-07 16:56:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2015-04-07 16:56:27 +0000
commitd436b2a4ce62125aea27479ae30acedf36f2d8c7 (patch)
treed0d9cc1dd082a9e321e5f61be53a1e9548d8c4c3 /clang
parentebad0aa3ba2b9fec4129ff843b1bf7f592ed8d73 (diff)
downloadbcm5719-llvm-d436b2a4ce62125aea27479ae30acedf36f2d8c7.tar.gz
bcm5719-llvm-d436b2a4ce62125aea27479ae30acedf36f2d8c7.zip
[Objective-C Sema] Patch to not issue unavailbility/deprecated
warning when multiple method declarations are found in global pool with differing types and some are available. rdar://20408445 llvm-svn: 234328
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp8
-rw-r--r--clang/test/SemaObjC/multiple-property-deprecated-decl.m19
2 files changed, 26 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 4865b08ddfd..a12f2b1b3b1 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -2240,8 +2240,14 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List,
if (getLangOpts().Modules && !getLangOpts().CurrentModule.empty())
continue;
- if (!MatchTwoMethodDeclarations(Method, List->getMethod()))
+ if (!MatchTwoMethodDeclarations(Method, List->getMethod())) {
+ // Even if two method types do not match, we would like to say
+ // there is more than one declaration so unavailability/deprecated
+ // warning is not too noisy.
+ if (!Method->isDefined())
+ List->setHasMoreThanOneDecl(true);
continue;
+ }
ObjCMethodDecl *PrevObjCMethod = List->getMethod();
diff --git a/clang/test/SemaObjC/multiple-property-deprecated-decl.m b/clang/test/SemaObjC/multiple-property-deprecated-decl.m
new file mode 100644
index 00000000000..d7dbd458a41
--- /dev/null
+++ b/clang/test/SemaObjC/multiple-property-deprecated-decl.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macosx10.11 -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-macosx10.11 -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
+// rdar://20408445
+
+@protocol NSFileManagerDelegate @end
+
+@interface NSFileManager
+@property (assign) id <NSFileManagerDelegate> delegate;
+@end
+
+@interface NSFontManager
+@property (assign) id delegate __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.11,message="" "NSFontManager doesn't have any delegate method. This property should not be used.")));
+
+@end
+
+id Test20408445(id p) {
+ return [p delegate];
+}
OpenPOWER on IntegriCloud