Author: fjahanian
Date: Tue Apr 7 11:56:27 2015
New Revision: 234328
URL: http://llvm.org/viewvc/llvm-project?rev=234328&view=rev
Log:
[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
Added:
cfe/trunk/test/SemaObjC/multiple-property-deprecated-decl.m
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=234328&r1=234327&r2=234328&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Apr 7 11:56:27 2015
@@ -2240,8 +2240,14 @@ void Sema::addMethodToGlobalList(ObjCMet
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();
Added: cfe/trunk/test/SemaObjC/multiple-property-deprecated-decl.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/multiple-property-deprecated-decl.m?rev=234328&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/multiple-property-deprecated-decl.m (added)
+++ cfe/trunk/test/SemaObjC/multiple-property-deprecated-decl.m Tue Apr 7
11:56:27 2015
@@ -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];
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits