r186944 - Replacing some manual diagnostic checks with an existing helper method. Adding missing test cases for the diagnostics.
Aaron Ballman
aaron at aaronballman.com
Tue Jul 23 08:16:00 PDT 2013
Author: aaronballman
Date: Tue Jul 23 10:16:00 2013
New Revision: 186944
URL: http://llvm.org/viewvc/llvm-project?rev=186944&view=rev
Log:
Replacing some manual diagnostic checks with an existing helper method. Adding missing test cases for the diagnostics.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/arc-unavailable-for-weakref.m
cfe/trunk/test/SemaObjC/attr-root-class.m
cfe/trunk/test/SemaObjC/default-synthesize-3.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=186944&r1=186943&r2=186944&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jul 23 10:16:00 2013
@@ -2073,11 +2073,8 @@ static void handleAttrWithMessage(Sema &
static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
const AttributeList &Attr) {
- unsigned NumArgs = Attr.getNumArgs();
- if (NumArgs > 0) {
- S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ if (!checkAttributeNumArgs(S, Attr, 0))
return;
- }
D->addAttr(::new (S.Context)
ArcWeakrefUnavailableAttr(Attr.getRange(), S.Context,
@@ -2092,11 +2089,8 @@ static void handleObjCRootClassAttr(Sema
return;
}
- unsigned NumArgs = Attr.getNumArgs();
- if (NumArgs > 0) {
- S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ if (!checkAttributeNumArgs(S, Attr, 0))
return;
- }
D->addAttr(::new (S.Context)
ObjCRootClassAttr(Attr.getRange(), S.Context,
@@ -2110,11 +2104,8 @@ static void handleObjCRequiresPropertyDe
return;
}
- unsigned NumArgs = Attr.getNumArgs();
- if (NumArgs > 0) {
- S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ if (!checkAttributeNumArgs(S, Attr, 0))
return;
- }
D->addAttr(::new (S.Context)
ObjCRequiresPropertyDefsAttr(Attr.getRange(), S.Context,
Modified: cfe/trunk/test/SemaObjC/arc-unavailable-for-weakref.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-unavailable-for-weakref.m?rev=186944&r1=186943&r2=186944&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-unavailable-for-weakref.m (original)
+++ cfe/trunk/test/SemaObjC/arc-unavailable-for-weakref.m Tue Jul 23 10:16:00 2013
@@ -86,3 +86,7 @@ __attribute__((objc_arc_weak_reference_u
@implementation I2 // expected-note {{when implemented by class I2}}
@synthesize font = _font;
@end
+
+__attribute__((objc_arc_weak_reference_unavailable(1))) // expected-error {{attribute 'objc_arc_weak_reference_unavailable' takes no arguments}}
+ at interface I3
+ at end
Modified: cfe/trunk/test/SemaObjC/attr-root-class.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-root-class.m?rev=186944&r1=186943&r2=186944&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-root-class.m (original)
+++ cfe/trunk/test/SemaObjC/attr-root-class.m Tue Jul 23 10:16:00 2013
@@ -14,3 +14,7 @@ __attribute__((objc_root_class))
__attribute__((objc_root_class)) static void nonClassDeclaration() // expected-error {{'objc_root_class' attribute only applies to Objective-C interfaces}}
{
}
+
+__attribute__((objc_root_class(1))) // expected-error {{attribute 'objc_root_class' takes no arguments}}
+ at interface I1
+ at end
Modified: cfe/trunk/test/SemaObjC/default-synthesize-3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize-3.m?rev=186944&r1=186943&r2=186944&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-3.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-3.m Tue Jul 23 10:16:00 2013
@@ -154,3 +154,6 @@ __attribute ((objc_requires_property_def
@synthesize failureCount = _failureCount;
@end
+__attribute ((objc_requires_property_definitions(1))) // expected-error {{attribute 'objc_requires_property_definitions' takes no arguments}}
+ at interface I1
+ at end
More information about the cfe-commits
mailing list