[cfe-commits] r142711 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/method-attributes.m

Fariborz Jahanian fjahanian at apple.com
Fri Oct 21 18:56:45 PDT 2011


Author: fjahanian
Date: Fri Oct 21 20:56:45 2011
New Revision: 142711

URL: http://llvm.org/viewvc/llvm-project?rev=142711&view=rev
Log:
Fixes a minor hick up to my last patch.

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/method-attributes.m

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=142711&r1=142710&r2=142711&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Oct 21 20:56:45 2011
@@ -2321,11 +2321,15 @@
 bool containsInvalidMethodImplAttribute(ObjCMethodDecl *IMD,
                                         const AttrVec &A) {
   // If method is only declared in implementation (private method),
-  // or method declared in interface has no attribute. 
   // No need to issue any diagnostics on method definition with attributes.
-  if (!IMD || !IMD->hasAttrs())
+  if (!IMD)
     return false;
 
+  // method declared in interface has no attribute. 
+  // But implementation has attributes. This is invalid
+  if (!IMD->hasAttrs())
+    return true;
+
   const AttrVec &D = IMD->getAttrs();
   if (D.size() != A.size())
     return true;

Modified: cfe/trunk/test/SemaObjC/method-attributes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-attributes.m?rev=142711&r1=142710&r2=142711&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-attributes.m (original)
+++ cfe/trunk/test/SemaObjC/method-attributes.m Fri Oct 21 20:56:45 2011
@@ -20,7 +20,7 @@
 @end
 
 @implementation INTF
-- (int) foo: (int)arg1  __attribute__((deprecated)){
+- (int) foo: (int)arg1  __attribute__((deprecated)){ // expected-warning {{method attribute can only be specified}}
         return 10;
 }
 - (int) foo1: (int)arg1 {





More information about the cfe-commits mailing list