r195850 - Adding in the subject for the init_priority attribute.
Aaron Ballman
aaron at aaronballman.com
Wed Nov 27 08:34:10 PST 2013
Author: aaronballman
Date: Wed Nov 27 10:34:09 2013
New Revision: 195850
URL: http://llvm.org/viewvc/llvm-project?rev=195850&view=rev
Log:
Adding in the subject for the init_priority attribute.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaCXX/init-priority-attr.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=195850&r1=195849&r2=195850&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed Nov 27 10:34:09 2013
@@ -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 {
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195850&r1=195849&r2=195850&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Nov 27 10:34:09 2013
@@ -2700,12 +2700,12 @@ static void handleInitPriorityAttr(Sema
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>()) {
Modified: cfe/trunk/test/SemaCXX/init-priority-attr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/init-priority-attr.cpp?rev=195850&r1=195849&r2=195850&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/init-priority-attr.cpp (original)
+++ cfe/trunk/test/SemaCXX/init-priority-attr.cpp Wed Nov 27 10:34:09 2013
@@ -25,8 +25,7 @@ Two coo[2] __attribute__((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}}
More information about the cfe-commits
mailing list