[OPENMP] Allow redeclaration of variables as threadprivate.
No need to emit an error message if the variable is redeclared as threadprivate.
llvm-svn: 234402
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9255220..3046301 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -759,7 +759,7 @@
// OpenMP [2.9.2, Restrictions, C/C++, p.2-6]
// A threadprivate directive must lexically precede all references to any
// of the variables in its list.
- if (VD->isUsed()) {
+ if (VD->isUsed() && !DSAStack->isThreadPrivate(CanonicalVD)) {
Diag(Id.getLoc(), diag::err_omp_var_used)
<< getOpenMPDirectiveName(OMPD_threadprivate) << VD;
return ExprError();