diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-01-13 03:35:30 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-01-13 03:35:30 +0000 |
commit | c4657ce15771243fda44de72d1f8fa6a25f76927 (patch) | |
tree | 0e404d36bdbd9a46830728290f29eeb6a05417bc /lib/Sema | |
parent | 85f2b4c24c7b307e65000b79c020cade580f8e48 (diff) |
[OPENMP] Consider global named register variables as threadprivate by default.
Register are thread-local by default, so we have to consider them as threadprivate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaOpenMP.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index b00867dd30..d72942a2ff 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -391,7 +391,8 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) { // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced // in a Construct, C/C++, predetermined, p.1] // Variables appearing in threadprivate directives are threadprivate. - if (D->getTLSKind() != VarDecl::TLS_None) { + if (D->getTLSKind() != VarDecl::TLS_None || + D->getStorageClass() == SC_Register) { DVar.CKind = OMPC_threadprivate; return DVar; } @@ -841,8 +842,10 @@ Sema::CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef<Expr *> VarList) { } // Check if this is a TLS variable. - if (VD->getTLSKind()) { - Diag(ILoc, diag::err_omp_var_thread_local) << VD; + if (VD->getTLSKind() != VarDecl::TLS_None || + VD->getStorageClass() == SC_Register) { + Diag(ILoc, diag::err_omp_var_thread_local) + << VD << ((VD->getTLSKind() != VarDecl::TLS_None) ? 0 : 1); bool IsDecl = VD->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly; Diag(VD->getLocation(), |