@@ -379,24 +379,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
379379 explicit OmpAttributeVisitor (SemanticsContext &context)
380380 : DirectiveAttributeVisitor(context) {}
381381
382- static const Scope &scopingUnit (const Scope &scope) {
383- const Scope *iter{&scope};
384- for (; !iter->IsTopLevel (); iter = &iter->parent ()) {
385- switch (iter->kind ()) {
386- case Scope::Kind::BlockConstruct:
387- case Scope::Kind::BlockData:
388- case Scope::Kind::DerivedType:
389- case Scope::Kind::MainProgram:
390- case Scope::Kind::Module:
391- case Scope::Kind::Subprogram:
392- return *iter;
393- default :
394- break ;
395- }
396- }
397- return *iter;
398- }
399-
400382 template <typename A> void Walk (const A &x) { parser::Walk (x, *this ); }
401383 template <typename A> bool Pre (const A &) { return true ; }
402384 template <typename A> void Post (const A &) {}
@@ -3086,8 +3068,8 @@ void OmpAttributeVisitor::ResolveOmpDesignator(
30863068 checkScope = ompFlag == Symbol::Flag::OmpExecutableAllocateDirective;
30873069 }
30883070 if (checkScope) {
3089- if (scopingUnit (GetContext ().scope ) !=
3090- scopingUnit (symbol->GetUltimate ().owner ())) {
3071+ if (omp::GetScopingUnit (GetContext ().scope ) !=
3072+ omp::GetScopingUnit (symbol->GetUltimate ().owner ())) {
30913073 context_.Say (designator.source , // 2.15.3
30923074 " List items must be declared in the same scoping unit in which the %s directive appears" _err_en_US,
30933075 parser::ToUpperCaseLetters (
0 commit comments