r195964 - Refactored the tls_model attribute to use a custom subset subject. No functional change intended.
Aaron Ballman
aaron at aaronballman.com
Fri Nov 29 08:20:31 PST 2013
Author: aaronballman
Date: Fri Nov 29 10:20:30 2013
New Revision: 195964
URL: http://llvm.org/viewvc/llvm-project?rev=195964&view=rev
Log:
Refactored the tls_model attribute to use a custom subset subject. No functional change intended.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=195964&r1=195963&r2=195964&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 29 10:20:30 2013
@@ -43,6 +43,9 @@ def ObjCInstanceMethod : SubsetSubject<O
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">];
}
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195964&r1=195963&r2=195964&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Nov 29 10:20:30 2013
@@ -1545,12 +1545,6 @@ static void handleTLSModelAttr(Sema &S,
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") {
More information about the cfe-commits
mailing list