[cfe-commits] r124858 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclAttr.cpp test/SemaObjC/ibaction.m

Ted Kremenek kremenek at apple.com
Thu Feb 3 22:54:17 PST 2011


Author: kremenek
Date: Fri Feb  4 00:54:16 2011
New Revision: 124858

URL: http://llvm.org/viewvc/llvm-project?rev=124858&view=rev
Log:
Downgrade error about attribute 'iboutlet' and 'ibaction' being applied to anything but a instance method to a warning.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/SemaObjC/ibaction.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=124858&r1=124857&r2=124858&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Feb  4 00:54:16 2011
@@ -1179,9 +1179,9 @@
 
 
 // Clang-Specific Attributes
-def err_attribute_iboutlet : Error<
+def warn_attribute_iboutlet : Warning<
   "%0 attribute can only be applied to instance variables or properties">;
-def err_attribute_ibaction: Error<
+def warn_attribute_ibaction: Warning<
   "ibaction attribute can only be applied to Objective-C instance methods">;
 def err_attribute_overloadable_not_function : Error<
   "'overloadable' attribute can only be applied to a function">;

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=124858&r1=124857&r2=124858&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Feb  4 00:54:16 2011
@@ -255,7 +255,7 @@
       return;
     }
 
-  S.Diag(Attr.getLoc(), diag::err_attribute_ibaction) << Attr.getName();
+  S.Diag(Attr.getLoc(), diag::warn_attribute_ibaction) << Attr.getName();
 }
 
 static void HandleIBOutlet(Decl *d, const AttributeList &Attr, Sema &S) {
@@ -272,7 +272,7 @@
     return;
   }
 
-  S.Diag(Attr.getLoc(), diag::err_attribute_iboutlet) << Attr.getName();
+  S.Diag(Attr.getLoc(), diag::warn_attribute_iboutlet) << Attr.getName();
 }
 
 static void HandleIBOutletCollection(Decl *d, const AttributeList &Attr,
@@ -287,7 +287,7 @@
   // The IBOutletCollection attributes only apply to instance variables of
   // Objective-C classes.
   if (!(isa<ObjCIvarDecl>(d) || isa<ObjCPropertyDecl>(d))) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_iboutlet) << Attr.getName();
+    S.Diag(Attr.getLoc(), diag::warn_attribute_iboutlet) << Attr.getName();
     return;
   }
   if (const ValueDecl *VD = dyn_cast<ValueDecl>(d))

Modified: cfe/trunk/test/SemaObjC/ibaction.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ibaction.m?rev=124858&r1=124857&r2=124858&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/ibaction.m (original)
+++ cfe/trunk/test/SemaObjC/ibaction.m Fri Feb  4 00:54:16 2011
@@ -4,10 +4,12 @@
 {
   __attribute__((iboutlet)) id myoutlet;
 }
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg; // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
 - (void) __attribute__((ibaction)) myMessage:(id)msg;
 @end
 
 @implementation Foo
++ (void) __attribute__((ibaction)) myClassMethod:(id)msg {} // expected-warning{{ibaction attribute can only be applied to Objective-C instance methods}}
 // Normally attributes should not be attached to method definitions, but
 // we allow 'ibaction' to be attached because it can be expanded from
 // the IBAction macro.





More information about the cfe-commits mailing list