forked from OSchip/llvm-project
[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:
parent
547e3eef14
commit
47567ca5fa
|
@ -232,8 +232,6 @@ protected:
|
||||||
// Check that only clauses in set are after the specific clauses.
|
// Check that only clauses in set are after the specific clauses.
|
||||||
void CheckOnlyAllowedAfter(C clause, common::EnumSet<C, ClauseEnumSize> set);
|
void CheckOnlyAllowedAfter(C clause, common::EnumSet<C, ClauseEnumSize> set);
|
||||||
|
|
||||||
void CheckRequired(C clause);
|
|
||||||
|
|
||||||
void CheckRequireAtLeastOneOf();
|
void CheckRequireAtLeastOneOf();
|
||||||
|
|
||||||
void CheckAllowed(C clause);
|
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>
|
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
|
||||||
void DirectiveStructureChecker<D, C, PC,
|
void DirectiveStructureChecker<D, C, PC,
|
||||||
ClauseEnumSize>::CheckRequireAtLeastOneOf() {
|
ClauseEnumSize>::CheckRequireAtLeastOneOf() {
|
||||||
|
if (GetContext().requiredClauses.empty())
|
||||||
|
return;
|
||||||
for (auto cl : GetContext().actualClauses) {
|
for (auto cl : GetContext().actualClauses) {
|
||||||
if (GetContext().requiredClauses.test(cl))
|
if (GetContext().requiredClauses.test(cl))
|
||||||
return;
|
return;
|
||||||
|
@ -447,17 +447,6 @@ void DirectiveStructureChecker<D, C, PC, ClauseEnumSize>::SayNotMatching(
|
||||||
.Attach(beginSource, "Does not match directive"_en_US);
|
.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.
|
// Check the value of the clause is a positive parameter.
|
||||||
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
|
template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
|
||||||
void DirectiveStructureChecker<D, C, PC,
|
void DirectiveStructureChecker<D, C, PC,
|
||||||
|
|
|
@ -393,8 +393,7 @@ void OmpStructureChecker::Leave(const parser::OmpClauseList &) {
|
||||||
llvm::omp::Clause::OMPC_copyprivate, {llvm::omp::Clause::OMPC_nowait});
|
llvm::omp::Clause::OMPC_copyprivate, {llvm::omp::Clause::OMPC_nowait});
|
||||||
}
|
}
|
||||||
|
|
||||||
GetContext().requiredClauses.IterateOverMembers(
|
CheckRequireAtLeastOneOf();
|
||||||
[this](llvm::omp::Clause c) { CheckRequired(c); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OmpStructureChecker::Enter(const parser::OmpClause &x) {
|
void OmpStructureChecker::Enter(const parser::OmpClause &x) {
|
||||||
|
|
|
@ -122,7 +122,7 @@ program main
|
||||||
enddo
|
enddo
|
||||||
!$omp end target data
|
!$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)
|
!$omp target data device(0)
|
||||||
do i = 1, N
|
do i = 1, N
|
||||||
a = 3.14
|
a = 3.14
|
||||||
|
|
Loading…
Reference in New Issue