r234328 - [Objective-C Sema] Patch to not issue unavailbility/deprecated

Fariborz Jahanian fjahanian at apple.com
Tue Apr 7 09:56:27 PDT 2015


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
+ 
+ at protocol NSFileManagerDelegate @end
+
+ at interface NSFileManager 
+ at property (assign) id <NSFileManagerDelegate> delegate;
+ at end
+
+ at interface NSFontManager
+ at 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.")));
+
+ at end
+
+id Test20408445(id p) {
+        return [p delegate];
+}





More information about the cfe-commits mailing list