[OPENMP] Support for codegen of private clause of target, host side
This patch adds support for codegen of private clause of target and a regression test for host code generation, when the host is used as target device. I believe that code generation for nvptx backend would not require anything additional or different to what is done for the host.
http://reviews.llvm.org/D18105
llvm-svn: 263654
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 0dd2509..64af40b 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4141,7 +4141,11 @@
const CapturedStmt &CS = *cast<CapturedStmt>(D.getAssociatedStmt());
// Emit target region as a standalone region.
- auto &&CodeGen = [&CS](CodeGenFunction &CGF) {
+ auto &&CodeGen = [&CS, &D](CodeGenFunction &CGF) {
+ CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
+ CGF.EmitOMPPrivateClause(D, PrivateScope);
+ (void)PrivateScope.Privatize();
+
CGF.EmitStmt(CS.getCapturedStmt());
};