Adding in the subject for the init_priority attribute.
llvm-svn: 195850
This commit is contained in:
parent
3c8e147a6b
commit
4a611153e1
|
@ -730,7 +730,7 @@ def WorkGroupSizeHint : InheritableAttr {
|
|||
def InitPriority : InheritableAttr {
|
||||
let Spellings = [GNU<"init_priority">];
|
||||
let Args = [UnsignedArgument<"Priority">];
|
||||
// let Subjects = [Var];
|
||||
let Subjects = SubjectList<[Var], ErrorDiag>;
|
||||
}
|
||||
|
||||
def Section : InheritableAttr {
|
||||
|
|
|
@ -2700,12 +2700,12 @@ static void handleInitPriorityAttr(Sema &S, Decl *D,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!isa<VarDecl>(D) || S.getCurFunctionOrMethodDecl()) {
|
||||
if (S.getCurFunctionOrMethodDecl()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_init_priority_object_attr);
|
||||
Attr.setInvalid();
|
||||
return;
|
||||
}
|
||||
QualType T = dyn_cast<VarDecl>(D)->getType();
|
||||
QualType T = cast<VarDecl>(D)->getType();
|
||||
if (S.Context.getAsArrayType(T))
|
||||
T = S.Context.getBaseElementType(T);
|
||||
if (!T->getAs<RecordType>()) {
|
||||
|
|
|
@ -25,8 +25,7 @@ Two coo[2] __attribute__((init_priority(3))); // expected-error {{init_priority
|
|||
|
||||
Two koo[4] __attribute__((init_priority(1.13))); // expected-error {{'init_priority' attribute requires an integer constant}}
|
||||
|
||||
|
||||
Two func() __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
|
||||
Two func() __attribute__((init_priority(1001))); // expected-error {{'init_priority' attribute only applies to variables}}
|
||||
|
||||
int i __attribute__((init_priority(1001))); // expected-error {{can only use 'init_priority' attribute on file-scope definitions of objects of class type}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue