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;
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),
#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;