diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntime.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index a8af23b63ac..8e23dcd2d20 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7347,6 +7347,9 @@ private: Cap.getCaptureKind() == CapturedStmt::VCK_ByRef) return MappableExprsHandler::OMP_MAP_ALWAYS | MappableExprsHandler::OMP_MAP_TO; + if (Cap.getCapturedVar()->getType()->isAnyPointerType()) + return MappableExprsHandler::OMP_MAP_TO | + MappableExprsHandler::OMP_MAP_PTR_AND_OBJ; return MappableExprsHandler::OMP_MAP_PRIVATE | MappableExprsHandler::OMP_MAP_TO; } @@ -7992,14 +7995,20 @@ public: CGF.Builder.CreateMemCpy( CGF.MakeNaturalAlignAddrLValue(Addr, ElementType).getAddress(), Address(CV, CGF.getContext().getTypeAlignInChars(ElementType)), - CurSizes.back(), - /*isVolatile=*/false); + CurSizes.back(), /*isVolatile=*/false); // Use new global variable as the base pointers. CurBasePointers.push_back(Addr); CurPointers.push_back(Addr); } else { CurBasePointers.push_back(CV); - CurPointers.push_back(CV); + if (FirstPrivateDecls.count(VD) && ElementType->isAnyPointerType()) { + Address PtrAddr = CGF.EmitLoadOfReference(CGF.MakeAddrLValue( + CV, ElementType, CGF.getContext().getDeclAlign(VD), + AlignmentSource::Decl)); + CurPointers.push_back(PtrAddr.getPointer()); + } else { + CurPointers.push_back(CV); + } } } // Every default map produces a single argument which is a target parameter. |

