diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-06 06:34:55 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-06 06:34:55 +0000 |
| commit | 1a8b3f1a4eb406d9fc45f3a132f7969c10c76619 (patch) | |
| tree | 7403de7ec2229508c33f31bc3618fa30ad785064 /clang/lib | |
| parent | 1d2854477c040b26232f7909f4575e190a3c13ba (diff) | |
| download | bcm5719-llvm-1a8b3f1a4eb406d9fc45f3a132f7969c10c76619.tar.gz bcm5719-llvm-1a8b3f1a4eb406d9fc45f3a132f7969c10c76619.zip | |
[OPENMP] Fix for http://llvm.org/PR23387: clang fails to compile magick/attribute.c
Allow to use variables with 'register' storage class as loop control variables in OpenMP loop based constructs.
llvm-svn: 236571
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index fb3cd9a4f92..4877d3f55fc 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -426,7 +426,8 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) { // in a Construct, C/C++, predetermined, p.1] // Variables appearing in threadprivate directives are threadprivate. if (D->getTLSKind() != VarDecl::TLS_None || - D->getStorageClass() == SC_Register) { + (D->getStorageClass() == SC_Register && D->hasAttr<AsmLabelAttr>() && + !D->isLocalVarDecl())) { DVar.CKind = OMPC_threadprivate; return DVar; } @@ -885,7 +886,8 @@ Sema::CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef<Expr *> VarList) { // Check if this is a TLS variable. if (VD->getTLSKind() != VarDecl::TLS_None || - VD->getStorageClass() == SC_Register) { + (VD->getStorageClass() == SC_Register && VD->hasAttr<AsmLabelAttr>() && + !VD->isLocalVarDecl())) { Diag(ILoc, diag::err_omp_var_thread_local) << VD << ((VD->getTLSKind() != VarDecl::TLS_None) ? 0 : 1); bool IsDecl = |

