LGTM
================
Comment at: lib/Sema/SemaDeclAttr.cpp:3700-3717
@@ -3699,1 +3699,20 @@
+static void handleDeclspecThreadAttr(Sema &S, Decl *D,
+ const AttributeList &Attr) {
+ VarDecl *VD = cast<VarDecl>(D);
+ if (!S.Context.getTargetInfo().isTLSSupported()) {
+ S.Diag(Attr.getLoc(), diag::err_thread_unsupported);
+ return;
+ }
+ if (VD->getTSCSpec() != TSCS_unspecified) {
+ S.Diag(Attr.getLoc(), diag::err_declspec_thread_on_thread_variable);
+ return;
+ }
+ if (VD->hasLocalStorage()) {
+ S.Diag(Attr.getLoc(), diag::err_thread_non_global) << "__declspec(thread)";
+ return;
+ }
+ VD->addAttr(::new (S.Context) ThreadAttr(
+ Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex()));
+}
+
----------------
Are you allowed to specify `__declspec(thread)` multiple times on the same
declaration? This would appear to allow that.
================
Comment at: lib/Sema/SemaDeclAttr.cpp:3711-3714
@@ +3710,6 @@
+ }
+ if (VD->hasLocalStorage()) {
+ S.Diag(Attr.getLoc(), diag::err_thread_non_global) << "__declspec(thread)";
+ return;
+ }
+ VD->addAttr(::new (S.Context) ThreadAttr(
----------------
Can you move the `hasLocalStorage` check into the common attribute subject
checking side of things? That'd be more in line with what we do elsewhere, but
might make the diagnostic less consistent with other thread specifiers, so I'm
on the fence.
http://reviews.llvm.org/D3551
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits