summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2018-02-27 21:31:11 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2018-02-27 21:31:11 +0000
commit95c23e72da98ecb84c562ca0fb8e23f7c6ceefa1 (patch)
treea66894cf088b38210078753a70ac4a040e51879c /clang/lib/Sema/SemaOpenMP.cpp
parent0594aee52fad70d2a0b44b321579b857b8cf9244 (diff)
downloadbcm5719-llvm-95c23e72da98ecb84c562ca0fb8e23f7c6ceefa1.tar.gz
bcm5719-llvm-95c23e72da98ecb84c562ca0fb8e23f7c6ceefa1.zip
[OPENMP] Emit warning for non-trivial types in map clauses.
If the mapped type is non-trivial, the warning message is emitted for better user experience. llvm-svn: 326251
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 7421da43e20..86b6091ae0e 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -11527,12 +11527,16 @@ OMPClause *Sema::ActOnOpenMPDeviceClause(Expr *Device, SourceLocation StartLoc,
}
static bool CheckTypeMappable(SourceLocation SL, SourceRange SR, Sema &SemaRef,
- DSAStackTy *Stack, QualType QTy) {
+ DSAStackTy *Stack, QualType QTy,
+ bool FullCheck = true) {
NamedDecl *ND;
if (QTy->isIncompleteType(&ND)) {
SemaRef.Diag(SL, diag::err_incomplete_type) << QTy << SR;
return false;
}
+ if (FullCheck && !SemaRef.CurContext->isDependentContext() &&
+ !QTy.isTrivialType(SemaRef.Context))
+ SemaRef.Diag(SL, diag::warn_omp_non_trivial_type_mapped) << QTy << SR;
return true;
}
@@ -12882,7 +12886,8 @@ static bool checkValueDeclInTarget(SourceLocation SL, SourceRange SR,
ValueDecl *VD) {
if (VD->hasAttr<OMPDeclareTargetDeclAttr>())
return true;
- if (!CheckTypeMappable(SL, SR, SemaRef, Stack, VD->getType()))
+ if (!CheckTypeMappable(SL, SR, SemaRef, Stack, VD->getType(),
+ /*FullCheck=*/false))
return false;
return true;
}
OpenPOWER on IntegriCloud