From 84c8baeef71efa9ab8461cfa41d9a7094cdd1bea Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 1 Apr 2019 16:56:59 +0000 Subject: [OPENMP]Allocate clause allocator in target region. According to OpenMP 5.0, 2.11.4 allocate Clause, Restrictions, allocate clauses that appear on a target construct or on constructs in a target region must specify an allocator expression unless a requires directive with the dynamic_allocators clause is present in the same compilation unit. Patch adds a check for this restriction. llvm-svn: 357412 --- clang/lib/Sema/SemaOpenMP.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/lib') diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index d564bf6bad4..9a9bdfaaf5d 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -14852,6 +14852,15 @@ OMPClause *Sema::ActOnOpenMPAllocateClause( if (AllocatorRes.isInvalid()) return nullptr; Allocator = AllocatorRes.get(); + } else { + // OpenMP 5.0, 2.11.4 allocate Clause, Restrictions. + // allocate clauses that appear on a target construct or on constructs in a + // target region must specify an allocator expression unless a requires + // directive with the dynamic_allocators clause is present in the same + // compilation unit. + if (LangOpts.OpenMPIsDevice && + !DSAStack->hasRequiresDeclWithClause()) + targetDiag(StartLoc, diag::err_expected_allocator_expression); } // Analyze and build list of variables. SmallVector Vars; -- cgit v1.2.3