r236574 - [OPENMP] Fixed messages about predetermined DSA for loop control variables.
Alexey Bataev
a.bataev at hotmail.com
Wed May 6 00:25:09 PDT 2015
Author: abataev
Date: Wed May 6 02:25:08 2015
New Revision: 236574
URL: http://llvm.org/viewvc/llvm-project?rev=236574&view=rev
Log:
[OPENMP] Fixed messages about predetermined DSA for loop control variables.
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_loop_messages.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=236574&r1=236573&r2=236574&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed May 6 02:25:08 2015
@@ -428,8 +428,13 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
if (D->getTLSKind() != VarDecl::TLS_None ||
(D->getStorageClass() == SC_Register && D->hasAttr<AsmLabelAttr>() &&
!D->isLocalVarDecl())) {
- DVar.CKind = OMPC_threadprivate;
- return DVar;
+ addDSA(D,
+ DeclRefExpr::Create(SemaRef.getASTContext(),
+ NestedNameSpecifierLoc(), SourceLocation(), D,
+ /*RefersToEnclosingVariableOrCapture=*/false,
+ D->getLocation(),
+ D->getType().getNonReferenceType(), VK_LValue),
+ OMPC_threadprivate);
}
if (Stack[0].SharingMap.count(D)) {
DVar.RefExpr = Stack[0].SharingMap[D].RefExpr;
@@ -2573,7 +2578,9 @@ static bool CheckOpenMPIterationSpace(
SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
<< getOpenMPClauseName(DVar.CKind) << getOpenMPDirectiveName(DKind)
<< getOpenMPClauseName(PredeterminedCKind);
- ReportOriginalDSA(SemaRef, &DSA, Var, DVar, true);
+ if (DVar.RefExpr == nullptr)
+ DVar.CKind = PredeterminedCKind;
+ ReportOriginalDSA(SemaRef, &DSA, Var, DVar, /*IsLoopIterVar=*/true);
HasErrors = true;
} else if (LoopVarRefExpr != nullptr) {
// Make the loop iteration variable private (for worksharing constructs),
Modified: cfe/trunk/test/OpenMP/for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_loop_messages.cpp?rev=236574&r1=236573&r2=236574&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_loop_messages.cpp Wed May 6 02:25:08 2015
@@ -13,7 +13,7 @@ static int sii;
#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
static int globalii;
-register int reg0 __asm__("0"); // expected-note {{loop iteration variable is predetermined as linear}}
+register int reg0 __asm__("0"); // expected-note {{defined as threadprivate or thread local}}
int test_iteration_spaces() {
const int N = 100;
More information about the cfe-commits
mailing list