Author: abataev Date: Fri Mar 7 02:03:37 2014 New Revision: 203214 URL: http://llvm.org/viewvc/llvm-project?rev=203214&view=rev Log: [OPENMP] Small update in threadprivate variables processing to fix template instantiation.
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=203214&r1=203213&r2=203214&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Mar 7 02:03:37 2014 @@ -525,8 +525,7 @@ ExprResult Sema::ActOnOpenMPIdExpression } 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::CheckOMPThre } Vars.push_back(*I); + DSAStack->addDSA(VD, DE, OMPC_threadprivate); } OMPThreadPrivateDecl *D = 0; if (!Vars.empty()) { Modified: cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp?rev=203214&r1=203213&r2=203214&view=diff ============================================================================== --- cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp Fri Mar 7 02:03:37 2014 @@ -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() { _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits