summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-04-07 12:45:37 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-04-07 12:45:37 +0000
commit2af33e3d3ff1cd0535602cf50b06539949a2b16b (patch)
treebcb4ff52ff2115bc25342cf17c17e4b4c2d82f56 /clang/lib/Sema/SemaOpenMP.cpp
parenta1feff7024b552b579f302fea0030aaaa14624b3 (diff)
downloadbcm5719-llvm-2af33e3d3ff1cd0535602cf50b06539949a2b16b.tar.gz
bcm5719-llvm-2af33e3d3ff1cd0535602cf50b06539949a2b16b.zip
[OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'
construct. OpenMP 4.0 defines '#pragma omp declare simd' construct that may have associated 'simdlen' clause with constant positive expression as an argument: simdlen(<const_expr>) Patch adds parsin and semantic analysis for simdlen clause. llvm-svn: 265668
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 0ef796557ae..3705cf211ea 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -3193,7 +3193,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
Sema::DeclGroupPtrTy
Sema::ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG,
OMPDeclareSimdDeclAttr::BranchStateTy BS,
- SourceRange SR) {
+ Expr *Simdlen, SourceRange SR) {
if (!DG || DG.get().isNull())
return DeclGroupPtrTy();
@@ -3211,7 +3211,17 @@ Sema::ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG,
return DeclGroupPtrTy();
}
- auto *NewAttr = OMPDeclareSimdDeclAttr::CreateImplicit(Context, BS, SR);
+ // OpenMP [2.8.2, declare simd construct, Description]
+ // The parameter of the simdlen clause must be a constant positive integer
+ // expression.
+ ExprResult SL;
+ if (Simdlen) {
+ SL = VerifyPositiveIntegerConstantInClause(Simdlen, OMPC_simdlen);
+ if (SL.isInvalid())
+ return DG;
+ }
+ auto *NewAttr =
+ OMPDeclareSimdDeclAttr::CreateImplicit(Context, BS, SL.get(), SR);
ADecl->addAttr(NewAttr);
return ConvertDeclToDeclGroup(ADecl);
}
OpenPOWER on IntegriCloud