Skip to content

Commit 7c33b82

Browse files
authored
[flang][OpenMP] Move two functions to check-omp-loop.cpp, NFC (#170526)
These are checks for clauses that apply to loop constructs.
1 parent 106edbd commit 7c33b82

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

flang/lib/Semantics/check-omp-loop.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,20 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
773773
}
774774
}
775775

776+
void OmpStructureChecker::Enter(const parser::OmpClause::Sizes &c) {
777+
CheckAllowedClause(llvm::omp::Clause::OMPC_sizes);
778+
for (const parser::Cosubscript &v : c.v)
779+
RequiresPositiveParameter(llvm::omp::Clause::OMPC_sizes, v,
780+
/*paramName=*/"parameter", /*allowZero=*/false);
781+
}
782+
783+
void OmpStructureChecker::Enter(const parser::OmpClause::Looprange &x) {
784+
CheckAllowedClause(llvm::omp::Clause::OMPC_looprange);
785+
auto &[first, count]{x.v.t};
786+
RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_looprange, count);
787+
RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_looprange, first);
788+
}
789+
776790
void OmpStructureChecker::Enter(const parser::DoConstruct &x) {
777791
Base::Enter(x);
778792
loopStack_.push_back(&x);

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,21 +3393,6 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
33933393
}
33943394
}
33953395

3396-
void OmpStructureChecker::Enter(const parser::OmpClause::Sizes &c) {
3397-
CheckAllowedClause(llvm::omp::Clause::OMPC_sizes);
3398-
for (const parser::Cosubscript &v : c.v)
3399-
RequiresPositiveParameter(llvm::omp::Clause::OMPC_sizes, v,
3400-
/*paramName=*/"parameter", /*allowZero=*/false);
3401-
}
3402-
3403-
void OmpStructureChecker::Enter(const parser::OmpClause::Looprange &x) {
3404-
CheckAllowedClause(llvm::omp::Clause::OMPC_looprange);
3405-
auto &first = std::get<0>(x.v.t);
3406-
auto &count = std::get<1>(x.v.t);
3407-
RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_looprange, count);
3408-
RequiresConstantPositiveParameter(llvm::omp::Clause::OMPC_looprange, first);
3409-
}
3410-
34113396
// Restrictions specific to each clause are implemented apart from the
34123397
// generalized restrictions.
34133398

0 commit comments

Comments
 (0)