diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2013-07-23 15:16:00 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2013-07-23 15:16:00 +0000 |
| commit | 283ef4234cd64508bf7f81cf6088d3ac492a54b7 (patch) | |
| tree | 688d93e69d6657ee7a29baf7ac63b205a3502bdb /clang | |
| parent | b914b58e9cd336b900e918392a78077f0f9cab26 (diff) | |
| download | bcm5719-llvm-283ef4234cd64508bf7f81cf6088d3ac492a54b7.tar.gz bcm5719-llvm-283ef4234cd64508bf7f81cf6088d3ac492a54b7.zip | |
Replacing some manual diagnostic checks with an existing helper method. Adding missing test cases for the diagnostics.
llvm-svn: 186944
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 15 | ||||
| -rw-r--r-- | clang/test/SemaObjC/arc-unavailable-for-weakref.m | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/attr-root-class.m | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/default-synthesize-3.m | 3 |
4 files changed, 14 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 00379b604ec..09d61e7b376 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -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, diff --git a/clang/test/SemaObjC/arc-unavailable-for-weakref.m b/clang/test/SemaObjC/arc-unavailable-for-weakref.m index b9b5cc516de..516611f9f8f 100644 --- a/clang/test/SemaObjC/arc-unavailable-for-weakref.m +++ b/clang/test/SemaObjC/arc-unavailable-for-weakref.m @@ -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 diff --git a/clang/test/SemaObjC/attr-root-class.m b/clang/test/SemaObjC/attr-root-class.m index 4f4c8b6997c..a21aefd712f 100644 --- a/clang/test/SemaObjC/attr-root-class.m +++ b/clang/test/SemaObjC/attr-root-class.m @@ -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 diff --git a/clang/test/SemaObjC/default-synthesize-3.m b/clang/test/SemaObjC/default-synthesize-3.m index ce8015479ee..e41a7d30cc7 100644 --- a/clang/test/SemaObjC/default-synthesize-3.m +++ b/clang/test/SemaObjC/default-synthesize-3.m @@ -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 |

