diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-11-22 11:09:33 -0500 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-11-22 11:26:09 -0500 |
| commit | 6f7c8760a5c01edaa8e9c8e48940e1b8a7aa4128 (patch) | |
| tree | ac17f06a612f753451693dfa9e5bf4b437027440 /clang/lib | |
| parent | 1a58be2ac58ca078c91c9d1700220d88091b256f (diff) | |
| download | bcm5719-llvm-6f7c8760a5c01edaa8e9c8e48940e1b8a7aa4128.tar.gz bcm5719-llvm-6f7c8760a5c01edaa8e9c8e48940e1b8a7aa4128.zip | |
[OPENMP]Fix behaviour of defaultmap for OpenMP 4.5.
In OpenMP 4.5 pointers also must be considered as scalar types and
defaultmap(tofrom:scalar) clause must affect mapping of the pointers
too.
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 45cac595004..53840d40016 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1763,7 +1763,12 @@ void Sema::checkOpenMPDeviceExpr(const Expr *E) { } static OpenMPDefaultmapClauseKind -getVariableCategoryFromDecl(const ValueDecl *VD) { +getVariableCategoryFromDecl(const LangOptions &LO, const ValueDecl *VD) { + if (LO.OpenMP <= 45) { + if (VD->getType().getNonReferenceType()->isScalarType()) + return OMPC_DEFAULTMAP_scalar; + return OMPC_DEFAULTMAP_aggregate; + } if (VD->getType().getNonReferenceType()->isAnyPointerType()) return OMPC_DEFAULTMAP_pointer; if (VD->getType().getNonReferenceType()->isScalarType()) @@ -1894,8 +1899,8 @@ bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, (DSAStack->isForceCaptureByReferenceInTargetExecutable() && !Ty->isAnyPointerType()) || !Ty->isScalarType() || - DSAStack->isDefaultmapCapturedByRef(Level, - getVariableCategoryFromDecl(D)) || + DSAStack->isDefaultmapCapturedByRef( + Level, getVariableCategoryFromDecl(LangOpts, D)) || DSAStack->hasExplicitDSA( D, [](OpenMPClauseKind K) { return K == OMPC_reduction; }, Level); } @@ -2112,8 +2117,8 @@ void Sema::setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, if (DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, NewLevel)) { OMPC = OMPC_map; - if (DSAStack->mustBeFirstprivateAtLevel(NewLevel, - getVariableCategoryFromDecl(D))) + if (DSAStack->mustBeFirstprivateAtLevel( + NewLevel, getVariableCategoryFromDecl(LangOpts, D))) OMPC = OMPC_firstprivate; break; } @@ -2944,7 +2949,8 @@ public: // data-haring attribute clause (including a data-sharing attribute // clause on a combined construct where target. is one of the // constituent constructs), or an is_device_ptr clause. - OpenMPDefaultmapClauseKind ClauseKind = getVariableCategoryFromDecl(VD); + OpenMPDefaultmapClauseKind ClauseKind = + getVariableCategoryFromDecl(SemaRef.getLangOpts(), VD); if (SemaRef.getLangOpts().OpenMP >= 50) { bool IsModifierNone = Stack->getDefaultmapModifier(ClauseKind) == OMPC_DEFAULTMAP_MODIFIER_none; |

