diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-22 14:41:39 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-22 14:41:39 +0000 |
commit | 2213dd61d623153c9671be880bd30d1d6bb0abaa (patch) | |
tree | 4d1ca7fc6e1b241341966ee9910c991c99d4a506 /clang/lib/Sema/SemaOpenMP.cpp | |
parent | 3285c0f065ec6ddb6cf8c41dbc76a3bde09e04a1 (diff) | |
download | bcm5719-llvm-2213dd61d623153c9671be880bd30d1d6bb0abaa.tar.gz bcm5719-llvm-2213dd61d623153c9671be880bd30d1d6bb0abaa.zip |
[OPENMP]Emit error message for allocate directive without allocator
clause in target region.
According to the OpenMP 5.0, 2.11.3 allocate Directive, Restrictions,
allocate directives that appear in a target region must specify an
allocator clause unless a requires directive with the dynamic_allocators
clause is present in the same compilation unit.
llvm-svn: 356752
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index e54652650ed..9232ab9d6e8 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2243,8 +2243,12 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPAllocateDirective( ArrayRef<OMPClause *> Clauses, DeclContext *Owner) { assert(Clauses.size() <= 1 && "Expected at most one clause."); Expr *Allocator = nullptr; - if (!Clauses.empty()) + if (Clauses.empty()) { + if (LangOpts.OpenMPIsDevice) + targetDiag(Loc, diag::err_expected_allocator_clause); + } else { Allocator = cast<OMPAllocatorClause>(Clauses.back())->getAllocator(); + } OMPAllocateDeclAttr::AllocatorTypeTy AllocatorKind = getAllocatorKind(*this, DSAStack, Allocator); SmallVector<Expr *, 8> Vars; |