[PATCH] Add support for __declspec(thread) under -fms-extensions
Richard Smith
richard at metafoo.co.uk
Tue Apr 29 18:14:38 PDT 2014
================
Comment at: include/clang/Basic/Attr.td:1671
@@ +1670,3 @@
+ let LangOpts = [MicrosoftExt];
+ let Documentation = [Undocumented];
+ let Subjects = SubjectList<[Var]>;
----------------
ITYM `ThreadDocs`?
================
Comment at: include/clang/Basic/AttrDocs.td:58
@@ +57,3 @@
+storage. It is available under the ``-fms-extensions`` flag for MSVC
+compatiblity. Documentation for the Visual C++ attribute is available on MSDN_.
+
----------------
Typo 'compatiblity'
================
Comment at: lib/Sema/SemaDecl.cpp:8928-8934
@@ +8927,9 @@
+ const CXXRecordDecl *RD = var->getType()->getAsCXXRecordDecl();
+ if (RD && RD->hasNonTrivialDefaultConstructor()) {
+ // MSVC doesn't allow thread local variables with any constructors, but we
+ // only look for the default constructor.
+ Diag(var->getLocation(), diag::err_thread_nontrivial_ctor);
+ if (getLangOpts().CPlusPlus11)
+ Diag(var->getLocation(), diag::note_use_thread_local);
+ }
+ }
----------------
This seems really weird. We're already checking for non-constant initialization; do you have any idea what this check is for? You can check for 'any constructor' using `CXXRecordDecl::hasUserDeclaredConstructor`.
http://reviews.llvm.org/D3551
More information about the cfe-commits
mailing list