Skip to content

Commit 520ecc7

Browse files
[LLVM-Flang][OpenMP] Skip Linear clause semantic check if ordered clause with (n) is specified
1 parent cabbaa2 commit 520ecc7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,8 +3013,17 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Linear &x) {
30133013
}
30143014
}
30153015

3016-
auto checkForValidLinearClause = [&](const parser::Name &name, bool is_ref) {
3017-
parser::CharBlock source{GetContext().clauseSource};
3016+
// 4.4.4 Ordered clause restriction
3017+
if (const auto *clause{
3018+
FindClause(GetContext(), llvm::omp::Clause::OMPC_ordered)}) {
3019+
const auto &orderedClause{std::get<parser::OmpClause::Ordered>(clause->u)};
3020+
if (orderedClause.v) {
3021+
return;
3022+
}
3023+
}
3024+
3025+
auto checkForValidLinearClaue = [&](const parser::Name &name, bool is_ref) {
3026+
parser::CharBlock source = GetContext().clauseSource;
30183027
std::string listItemName{name.ToString()};
30193028
if (!is_ref && !name.symbol->GetType()->IsNumeric(TypeCategory::Integer)) {
30203029
context_.Say(source,

0 commit comments

Comments
 (0)