@@ -1011,11 +1011,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
10111011 sourceLabels_.clear ();
10121012 targetLabels_.clear ();
10131013 };
1014- void CheckAllNamesInAllocateStmt (const parser::CharBlock &source,
1015- const parser::OmpObjectList &ompObjectList,
1016- const parser::AllocateStmt &allocate);
1017- void CheckNameInAllocateStmt (const parser::CharBlock &source,
1018- const parser::Name &ompObject, const parser::AllocateStmt &allocate);
10191014
10201015 std::int64_t ordCollapseLevel{0 };
10211016
@@ -2550,8 +2545,6 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDispatchConstruct &x) {
25502545}
25512546
25522547bool OmpAttributeVisitor::Pre (const parser::OpenMPExecutableAllocate &x) {
2553- IssueNonConformanceWarning (llvm::omp::Directive::OMPD_allocate, x.source , 52 );
2554-
25552548 PushContext (x.source , llvm::omp::Directive::OMPD_allocate);
25562549 const auto &list{std::get<std::optional<parser::OmpObjectList>>(x.t )};
25572550 if (list) {
@@ -2632,83 +2625,10 @@ bool OmpAttributeVisitor::IsNestedInDirective(llvm::omp::Directive directive) {
26322625}
26332626
26342627void OmpAttributeVisitor::Post (const parser::OpenMPExecutableAllocate &x) {
2635- bool hasAllocator = false ;
2636- // TODO: Investigate whether searching the clause list can be done with
2637- // parser::Unwrap instead of the following loop
2638- const auto &clauseList{std::get<parser::OmpClauseList>(x.t )};
2639- for (const auto &clause : clauseList.v ) {
2640- if (std::get_if<parser::OmpClause::Allocator>(&clause.u )) {
2641- hasAllocator = true ;
2642- }
2643- }
2644-
2645- if (IsNestedInDirective (llvm::omp::Directive::OMPD_target) && !hasAllocator) {
2646- // TODO: expand this check to exclude the case when a requires
2647- // directive with the dynamic_allocators clause is present
2648- // in the same compilation unit (OMP5.0 2.11.3).
2649- context_.Say (x.source ,
2650- " ALLOCATE directives that appear in a TARGET region "
2651- " must specify an allocator clause" _err_en_US);
2652- }
2653-
2654- const auto &allocateStmt =
2655- std::get<parser::Statement<parser::AllocateStmt>>(x.t ).statement ;
2656- if (const auto &list{std::get<std::optional<parser::OmpObjectList>>(x.t )}) {
2657- CheckAllNamesInAllocateStmt (
2658- std::get<parser::Verbatim>(x.t ).source , *list, allocateStmt);
2659- }
2660- if (const auto &subDirs{
2661- std::get<std::optional<std::list<parser::OpenMPDeclarativeAllocate>>>(
2662- x.t )}) {
2663- for (const auto &dalloc : *subDirs) {
2664- CheckAllNamesInAllocateStmt (std::get<parser::Verbatim>(dalloc.t ).source ,
2665- std::get<parser::OmpObjectList>(dalloc.t ), allocateStmt);
2666- }
2667- }
26682628 PopContext ();
26692629}
26702630
26712631void OmpAttributeVisitor::Post (const parser::OpenMPAllocatorsConstruct &x) {
2672- const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir ()};
2673- auto &block{std::get<parser::Block>(x.t )};
2674-
2675- omp::SourcedActionStmt action{omp::GetActionStmt (block)};
2676- const parser::AllocateStmt *allocate{[&]() {
2677- if (action) {
2678- if (auto *alloc{std::get_if<common::Indirection<parser::AllocateStmt>>(
2679- &action.stmt ->u )}) {
2680- return &alloc->value ();
2681- }
2682- }
2683- return static_cast <const parser::AllocateStmt *>(nullptr );
2684- }()};
2685-
2686- if (allocate) {
2687- for (const auto &clause : dirSpec.Clauses ().v ) {
2688- if (auto *alloc{std::get_if<parser::OmpClause::Allocate>(&clause.u )}) {
2689- CheckAllNamesInAllocateStmt (
2690- x.source , std::get<parser::OmpObjectList>(alloc->v .t ), *allocate);
2691-
2692- using OmpAllocatorSimpleModifier = parser::OmpAllocatorSimpleModifier;
2693- using OmpAllocatorComplexModifier = parser::OmpAllocatorComplexModifier;
2694-
2695- auto &modifiers{OmpGetModifiers (alloc->v )};
2696- bool hasAllocator{
2697- OmpGetUniqueModifier<OmpAllocatorSimpleModifier>(modifiers) ||
2698- OmpGetUniqueModifier<OmpAllocatorComplexModifier>(modifiers)};
2699-
2700- // TODO: As with allocate directive, exclude the case when a requires
2701- // directive with the dynamic_allocators clause is present in
2702- // the same compilation unit (OMP5.0 2.11.3).
2703- if (IsNestedInDirective (llvm::omp::Directive::OMPD_target) &&
2704- !hasAllocator) {
2705- context_.Say (x.source ,
2706- " ALLOCATORS directives that appear in a TARGET region "
2707- " must specify an allocator" _err_en_US);
2708- }
2709- }
2710- }
2711- }
27122632 PopContext ();
27132633}
27142634
@@ -3628,44 +3548,6 @@ void OmpAttributeVisitor::CheckLabelContext(const parser::CharBlock source,
36283548 }
36293549}
36303550
3631- // Goes through the names in an OmpObjectList and checks if each name appears
3632- // in the given allocate statement
3633- void OmpAttributeVisitor::CheckAllNamesInAllocateStmt (
3634- const parser::CharBlock &source, const parser::OmpObjectList &ompObjectList,
3635- const parser::AllocateStmt &allocate) {
3636- for (const auto &obj : ompObjectList.v ) {
3637- if (const auto *d{std::get_if<parser::Designator>(&obj.u )}) {
3638- if (const auto *ref{std::get_if<parser::DataRef>(&d->u )}) {
3639- if (const auto *n{std::get_if<parser::Name>(&ref->u )}) {
3640- CheckNameInAllocateStmt (source, *n, allocate);
3641- }
3642- }
3643- }
3644- }
3645- }
3646-
3647- void OmpAttributeVisitor::CheckNameInAllocateStmt (
3648- const parser::CharBlock &source, const parser::Name &name,
3649- const parser::AllocateStmt &allocate) {
3650- for (const auto &allocation :
3651- std::get<std::list<parser::Allocation>>(allocate.t )) {
3652- const auto &allocObj = std::get<parser::AllocateObject>(allocation.t );
3653- if (const auto *n{std::get_if<parser::Name>(&allocObj.u )}) {
3654- if (n->source == name.source ) {
3655- return ;
3656- }
3657- }
3658- }
3659- unsigned version{context_.langOptions ().OpenMPVersion };
3660- context_.Say (source,
3661- " Object '%s' in %s directive not "
3662- " found in corresponding ALLOCATE statement" _err_en_US,
3663- name.ToString (),
3664- parser::ToUpperCaseLetters (
3665- llvm::omp::getOpenMPDirectiveName (GetContext ().directive , version)
3666- .str ()));
3667- }
3668-
36693551void OmpAttributeVisitor::AddOmpRequiresToScope (Scope &scope,
36703552 WithOmpDeclarative::RequiresFlags flags,
36713553 std::optional<common::OmpMemoryOrderType> memOrder) {
0 commit comments