]> granicus.if.org Git - clang/commitdiff
Replacing some manual diagnostic checks with an existing helper method. Adding missi...
authorAaron Ballman <aaron@aaronballman.com>
Tue, 23 Jul 2013 15:16:00 +0000 (15:16 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 23 Jul 2013 15:16:00 +0000 (15:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186944 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/arc-unavailable-for-weakref.m
test/SemaObjC/attr-root-class.m
test/SemaObjC/default-synthesize-3.m

index 00379b604ec33612c5558c5c9c1fe1bf7a8f3864..09d61e7b37633ea9fd0501ee25529fbb2dc3352d 100644 (file)
@@ -2073,11 +2073,8 @@ static void handleAttrWithMessage(Sema &S, Decl *D,
 
 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 &S, Decl *D,
     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 handleObjCRequiresPropertyDefsAttr(Sema &S, Decl *D,
     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,
index b9b5cc516deaed2acb7ef36c09dd7a04fde93e32..516611f9f8fba8057400879b0ebc5a8033d65565 100644 (file)
@@ -86,3 +86,7 @@ __attribute__((objc_arc_weak_reference_unavailable))
 @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}}
+@interface I3
+@end
index 4f4c8b6997ce5a8e3bacbc5936f0832d545100a8..a21aefd712ffeebc79bc177514c4c75233c9ceda 100644 (file)
@@ -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}}
+@interface I1
+@end
index ce8015479ee7718431910af38c78ab7a5252cf89..e41a7d30cc75f019be9877f79388fde1ca237352 100644 (file)
@@ -154,3 +154,6 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
 @synthesize failureCount = _failureCount;
 @end
 
+__attribute ((objc_requires_property_definitions(1))) // expected-error {{attribute 'objc_requires_property_definitions' takes no arguments}}
+@interface I1
+@end