r233913 - [OPENMP] Fix crash on private variables not used in OpenMP region in templates.
Alexey Bataev
a.bataev at hotmail.com
Thu Apr 2 06:07:08 PDT 2015
Author: abataev
Date: Thu Apr 2 08:07:08 2015
New Revision: 233913
URL: http://llvm.org/viewvc/llvm-project?rev=233913&view=rev
Log:
[OPENMP] Fix crash on private variables not used in OpenMP region in templates.
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=233913&r1=233912&r2=233913&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Apr 2 08:07:08 2015
@@ -1199,7 +1199,7 @@ StmtResult Sema::ActOnOpenMPRegionEnd(St
if (isOpenMPPrivate(Clause->getClauseKind())) {
for (auto *VarRef : Clause->children()) {
if (auto *E = cast_or_null<Expr>(VarRef)) {
- MarkDeclarationsReferencedInExpr(cast<Expr>(E));
+ MarkDeclarationsReferencedInExpr(E);
}
}
}
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=233913&r1=233912&r2=233913&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Thu Apr 2 08:07:08 2015
@@ -6670,7 +6670,16 @@ StmtResult TreeTransform<Derived>::Trans
if (!D->getAssociatedStmt()) {
return StmtError();
}
- AssociatedStmt = getDerived().TransformStmt(D->getAssociatedStmt());
+ getDerived().getSema().ActOnOpenMPRegionStart(D->getDirectiveKind(),
+ /*CurScope=*/nullptr);
+ StmtResult Body;
+ {
+ Sema::CompoundScopeRAII CompoundScope(getSema());
+ Body = getDerived().TransformStmt(
+ cast<CapturedStmt>(D->getAssociatedStmt())->getCapturedStmt());
+ }
+ AssociatedStmt =
+ getDerived().getSema().ActOnOpenMPRegionEnd(Body, TClauses);
if (AssociatedStmt.isInvalid()) {
return StmtError();
}
Modified: cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp?rev=233913&r1=233912&r2=233913&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp Thu Apr 2 08:07:08 2015
@@ -45,6 +45,8 @@ T tmain() {
vec[0] = t_var;
s_arr[0] = var;
}
+#pragma omp parallel firstprivate(t_var)
+ {}
return T();
}
More information about the cfe-commits
mailing list