@@ -379,24 +379,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
379
379
explicit OmpAttributeVisitor (SemanticsContext &context)
380
380
: DirectiveAttributeVisitor(context) {}
381
381
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
-
400
382
template <typename A> void Walk (const A &x) { parser::Walk (x, *this ); }
401
383
template <typename A> bool Pre (const A &) { return true ; }
402
384
template <typename A> void Post (const A &) {}
@@ -3086,8 +3068,8 @@ void OmpAttributeVisitor::ResolveOmpDesignator(
3086
3068
checkScope = ompFlag == Symbol::Flag::OmpExecutableAllocateDirective;
3087
3069
}
3088
3070
if (checkScope) {
3089
- if (scopingUnit (GetContext ().scope ) !=
3090
- scopingUnit (symbol->GetUltimate ().owner ())) {
3071
+ if (omp::GetScopingUnit (GetContext ().scope ) !=
3072
+ omp::GetScopingUnit (symbol->GetUltimate ().owner ())) {
3091
3073
context_.Say (designator.source , // 2.15.3
3092
3074
" List items must be declared in the same scoping unit in which the %s directive appears" _err_en_US,
3093
3075
parser::ToUpperCaseLetters (
0 commit comments