[flang][openxx][NFC] Remove duplicated function to check required clauses

Remove duplicated function to check for required clauses on a directive. This was
still there from the merging of OpenACC and OpenMP common semantic checks and it can now be
removed so we use only one function.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D93575
This commit is contained in:
Valentin Clement 2021-01-11 14:08:35 -05:00 committed by clementval
parent 547e3eef14
commit 47567ca5fa
3 changed files with 4 additions and 16 deletions

View File

@ -232,8 +232,6 @@ protected:
// Check that only clauses in set are after the specific clauses.
void CheckOnlyAllowedAfter(C clause, common::EnumSet<C, ClauseEnumSize> set);
void CheckRequired(C clause);
void CheckRequireAtLeastOneOf();
void CheckAllowed(C clause);
@ -326,6 +324,8 @@ DirectiveStructureChecker<D, C, PC, ClauseEnumSize>::ClauseSetToString(
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
void DirectiveStructureChecker<D, C, PC,
ClauseEnumSize>::CheckRequireAtLeastOneOf() {
if (GetContext().requiredClauses.empty())
return;
for (auto cl : GetContext().actualClauses) {
if (GetContext().requiredClauses.test(cl))
return;
@ -447,17 +447,6 @@ void DirectiveStructureChecker<D, C, PC, ClauseEnumSize>::SayNotMatching(
.Attach(beginSource, "Does not match directive"_en_US);
}
// Check that at least one of the required clauses is present on the directive.
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
void DirectiveStructureChecker<D, C, PC, ClauseEnumSize>::CheckRequired(C c) {
if (!FindClause(c)) {
context_.Say(GetContext().directiveSource,
"At least one %s clause must appear on the %s directive"_err_en_US,
parser::ToUpperCaseLetters(getClauseName(c).str()),
ContextDirectiveAsFortran());
}
}
// Check the value of the clause is a positive parameter.
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
void DirectiveStructureChecker<D, C, PC,

View File

@ -393,8 +393,7 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
llvm::omp::Clause::OMPC_copyprivate, {llvm::omp::Clause::OMPC_nowait});
}
GetContext().requiredClauses.IterateOverMembers(
[this](llvm::omp::Clause c) { CheckRequired(c); });
CheckRequireAtLeastOneOf();
}
void OmpStructureChecker::Enter(const parser::OmpClause &x) {

View File

@ -122,7 +122,7 @@ program main
enddo
!$omp end target data
!ERROR: At least one MAP clause must appear on the TARGET DATA directive
!ERROR: At least one of MAP clause must appear on the TARGET DATA directive
!$omp target data device(0)
do i = 1, N
a = 3.14