forked from OSchip/llvm-project
Replacing some manual diagnostic checks with an existing helper method. Adding missing test cases for the diagnostics.
llvm-svn: 186944
This commit is contained in:
parent
b914b58e9c
commit
283ef4234c
|
@ -2073,11 +2073,8 @@ static void handleAttrWithMessage(Sema &S, Decl *D,
|
||||||
|
|
||||||
static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
|
static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
|
||||||
const AttributeList &Attr) {
|
const AttributeList &Attr) {
|
||||||
unsigned NumArgs = Attr.getNumArgs();
|
if (!checkAttributeNumArgs(S, Attr, 0))
|
||||||
if (NumArgs > 0) {
|
|
||||||
S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
D->addAttr(::new (S.Context)
|
D->addAttr(::new (S.Context)
|
||||||
ArcWeakrefUnavailableAttr(Attr.getRange(), S.Context,
|
ArcWeakrefUnavailableAttr(Attr.getRange(), S.Context,
|
||||||
|
@ -2092,11 +2089,8 @@ static void handleObjCRootClassAttr(Sema &S, Decl *D,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned NumArgs = Attr.getNumArgs();
|
if (!checkAttributeNumArgs(S, Attr, 0))
|
||||||
if (NumArgs > 0) {
|
|
||||||
S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
D->addAttr(::new (S.Context)
|
D->addAttr(::new (S.Context)
|
||||||
ObjCRootClassAttr(Attr.getRange(), S.Context,
|
ObjCRootClassAttr(Attr.getRange(), S.Context,
|
||||||
|
@ -2110,11 +2104,8 @@ static void handleObjCRequiresPropertyDefsAttr(Sema &S, Decl *D,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned NumArgs = Attr.getNumArgs();
|
if (!checkAttributeNumArgs(S, Attr, 0))
|
||||||
if (NumArgs > 0) {
|
|
||||||
S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
D->addAttr(::new (S.Context)
|
D->addAttr(::new (S.Context)
|
||||||
ObjCRequiresPropertyDefsAttr(Attr.getRange(), S.Context,
|
ObjCRequiresPropertyDefsAttr(Attr.getRange(), S.Context,
|
||||||
|
|
|
@ -86,3 +86,7 @@ __attribute__((objc_arc_weak_reference_unavailable))
|
||||||
@implementation I2 // expected-note {{when implemented by class I2}}
|
@implementation I2 // expected-note {{when implemented by class I2}}
|
||||||
@synthesize font = _font;
|
@synthesize font = _font;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
__attribute__((objc_arc_weak_reference_unavailable(1))) // expected-error {{attribute 'objc_arc_weak_reference_unavailable' takes no arguments}}
|
||||||
|
@interface I3
|
||||||
|
@end
|
||||||
|
|
|
@ -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)) 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
|
||||||
|
|
|
@ -154,3 +154,6 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
|
||||||
@synthesize failureCount = _failureCount;
|
@synthesize failureCount = _failureCount;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
__attribute ((objc_requires_property_definitions(1))) // expected-error {{attribute 'objc_requires_property_definitions' takes no arguments}}
|
||||||
|
@interface I1
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue