diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-03-07 08:03:37 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-03-07 08:03:37 +0000 |
commit | d178ad4943926f45a95d320c90f89f55b00ec68e (patch) | |
tree | b93bce60910173dc27cfafa0f8290a723b08aa47 | |
parent | e1974dcd92b0f27e4a8ba54887640b2a93993b40 (diff) | |
download | bcm5719-llvm-d178ad4943926f45a95d320c90f89f55b00ec68e.tar.gz bcm5719-llvm-d178ad4943926f45a95d320c90f89f55b00ec68e.zip |
[OPENMP] Small update in threadprivate variables processing to fix template instantiation.
llvm-svn: 203214
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 4 | ||||
-rw-r--r-- | clang/test/OpenMP/threadprivate_ast_print.cpp | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index b99b639ac27..b814706a61a 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -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()) { diff --git a/clang/test/OpenMP/threadprivate_ast_print.cpp b/clang/test/OpenMP/threadprivate_ast_print.cpp index bf3b30550ad..4d0d40e213f 100644 --- a/clang/test/OpenMP/threadprivate_ast_print.cpp +++ b/clang/test/OpenMP/threadprivate_ast_print.cpp @@ -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() { |