Refactored the tls_model attribute to use a custom subset subject. No functional change intended.

llvm-svn: 195964
This commit is contained in:
Aaron Ballman 2013-11-29 16:20:30 +00:00
parent f7cd09a047
commit 5b0481a398
2 changed files with 4 additions and 7 deletions

View File

@ -43,6 +43,9 @@ def ObjCInstanceMethod : SubsetSubject<ObjCMethod,
def Struct : SubsetSubject<Record,
[{!S->isUnion()}]>;
def TLSVar : SubsetSubject<Var,
[{S->getTLSKind() != 0}]>;
// A single argument to an attribute
class Argument<string name, bit optional> {
string Name = name;
@ -220,7 +223,7 @@ def AlwaysInline : InheritableAttr {
def TLSModel : InheritableAttr {
let Spellings = [GNU<"tls_model">, CXX11<"gnu", "tls_model">];
let Subjects = SubjectList<[Var], ErrorDiag, "ExpectedTLSVar">;
let Subjects = SubjectList<[TLSVar], ErrorDiag, "ExpectedTLSVar">;
let Args = [StringArgument<"Model">];
}

View File

@ -1545,12 +1545,6 @@ static void handleTLSModelAttr(Sema &S, Decl *D,
if (!S.checkStringLiteralArgumentAttr(Attr, 0, Model, &LiteralLoc))
return;
if (!cast<VarDecl>(D)->getTLSKind()) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
<< Attr.getName() << ExpectedTLSVar;
return;
}
// Check that the value.
if (Model != "global-dynamic" && Model != "local-dynamic"
&& Model != "initial-exec" && Model != "local-exec") {