diff options
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 6 | ||||
-rw-r--r-- | test/SemaObjC/ibaction.m | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 0df95a254f..b5e1b81bf8 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1179,9 +1179,9 @@ def err_attribute_regparm_invalid_number : Error< // 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">; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 09fdf8dca4..08a7c49d31 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -255,7 +255,7 @@ static void HandleIBAction(Decl *d, const AttributeList &Attr, Sema &S) { 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 @@ static void HandleIBOutlet(Decl *d, const AttributeList &Attr, Sema &S) { 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 @@ static void HandleIBOutletCollection(Decl *d, const AttributeList &Attr, // 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)) diff --git a/test/SemaObjC/ibaction.m b/test/SemaObjC/ibaction.m index b97e002833..bcedf83340 100644 --- a/test/SemaObjC/ibaction.m +++ b/test/SemaObjC/ibaction.m @@ -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. |