forked from OSchip/llvm-project
[OPENMP] Small update in threadprivate variables processing to fix template instantiation.
llvm-svn: 203214
This commit is contained in:
parent
e1974dcd92
commit
d178ad4943
|
@ -525,8 +525,7 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope,
|
|||
}
|
||||
|
||||
QualType ExprType = VD->getType().getNonReferenceType();
|
||||
ExprResult DE = BuildDeclRefExpr(VD, ExprType, VK_RValue, Id.getLoc());
|
||||
DSAStack->addDSA(VD, cast<DeclRefExpr>(DE.get()), OMPC_threadprivate);
|
||||
ExprResult DE = BuildDeclRefExpr(VD, ExprType, VK_LValue, Id.getLoc());
|
||||
return DE;
|
||||
}
|
||||
|
||||
|
@ -582,6 +581,7 @@ OMPThreadPrivateDecl *Sema::CheckOMPThreadPrivateDecl(
|
|||
}
|
||||
|
||||
Vars.push_back(*I);
|
||||
DSAStack->addDSA(VD, DE, OMPC_threadprivate);
|
||||
}
|
||||
OMPThreadPrivateDecl *D = 0;
|
||||
if (!Vars.empty()) {
|
||||
|
|
|
@ -26,9 +26,16 @@ int a, b;
|
|||
#pragma omp threadprivate(d, b)
|
||||
// CHECK-NEXT: #pragma omp threadprivate(d,b)
|
||||
|
||||
template <class T>
|
||||
struct ST {
|
||||
static T m;
|
||||
#pragma omp threadprivate(m)
|
||||
};
|
||||
|
||||
template <class T> T foo() {
|
||||
static T v;
|
||||
#pragma omp threadprivate(v)
|
||||
v = ST<T>::m;
|
||||
return v;
|
||||
}
|
||||
//CHECK: template <class T = int> int foo() {
|
||||
|
|
Loading…
Reference in New Issue