Lines Matching defs:clause
20 // Use when clause falls under 'struct OmpClause' in 'parse-tree.h'.
38 // Use when clause don't falls under 'struct OmpClause' in 'parse-tree.h'.
240 bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) {
241 // Do not do clause checks while processing METADIRECTIVE.
255 if (!llvm::omp::isAllowedClauseForDirective(dir, clause, version)) {
261 if (llvm::omp::isAllowedClauseForDirective(dir, clause, v)) {
271 auto clauseName{parser::ToUpperCaseLetters(getClauseName(clause).str())};
275 "%s clause is not allowed on directive %s in %s, %s"_err_en_US,
280 return CheckAllowed(clause);
407 // Aligned clause
408 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_aligned)) {
409 const auto &alignedClause{std::get<parser::OmpClause::Aligned>(clause->u)};
416 context_.Say(clause->source,
418 "ALIGNED clause"_err_en_US,
423 context_.Say(clause->source,
424 "'%s' in ALIGNED clause must be of type C_PTR, POINTER or "
437 listVars, alignedNameList, clause->source, "ALIGNED");
440 // Nontemporal clause
441 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_nontemporal)) {
443 std::get<parser::OmpClause::Nontemporal>(clause->u)};
446 listVars, nontempNameList, clause->source, "NONTEMPORAL");
449 // Linear clause
450 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_linear)) {
451 auto &linearClause{std::get<parser::OmpClause::Linear>(clause->u)};
459 CheckMultipleOccurrence(listVars, nameList, clause->source, "LINEAR");
507 for (const auto &clause : clauseList.v) {
509 std::get_if<parser::OmpClause::Bind>(&clause.u)}) {
558 "in the allocator clause"_err_en_US,
590 for (const auto &clause : clauseList->v) {
593 ompClause = std::get_if<parser::OmpClause>(&clause.u);
597 ompClause = &clause;
607 context_.Say(clause.source,
608 "Hint clause value "
611 context_.Say(clause.source,
612 "Hint clause must have non-negative constant "
702 // 2.7.1 do-clause -> private-clause |
703 // firstprivate-clause |
704 // lastprivate-clause |
705 // linear-clause |
706 // reduction-clause |
707 // schedule-clause |
708 // collapse-clause |
709 // ordered-clause
841 // construct and the `ordered` construct with the `simd` clause.
845 // Check if the parent context has the SIMD clause
862 for (const auto &clause : clauses.v) {
863 if (std::get_if<parser::OmpClause::Simd>(&clause.u)) {
879 for (const auto &clause : clauses.v) {
880 if (std::get_if<parser::OmpClause::Simd>(&clause.u)) {
913 "construct with the `SIMD` clause."_err_en_US);
982 for (const auto &clause : clauseList.v) {
984 std::get_if<parser::OmpClause::Collapse>(&clause.u)}) {
990 std::get_if<parser::OmpClause::Ordered>(&clause.u)}) {
1020 for (auto &clause : clauses.v) {
1021 if (auto *linearClause{std::get_if<parser::OmpClause::Linear>(&clause.u)}) {
1063 "Variable '%s' not allowed in LINEAR clause, only loop iterator can be specified in LINEAR clause of a construct combined with DISTRIBUTE"_err_en_US,
1078 for (const auto &clause : clauseList.v) {
1080 std::get_if<parser::OmpClause::Reduction>(&clause.u)}) {
1093 "INCLUSIVE clause of an "
1133 // 2.7.1 end-do -> END DO [nowait-clause]
1134 // 2.8.3 end-do-simd -> END DO SIMD [nowait-clause]
1227 for (const auto &clause : clauses.v) {
1228 if (std::get_if<parser::OmpClause::Untied>(&clause.u)) {
1288 if (const auto *clause{
1291 std::get<parser::OmpClause::Ordered>(clause->u)};
1311 "An ORDERED directive without the DEPEND clause must be closely nested "
1319 "An ORDERED directive with SIMD clause must be closely nested in a "
1324 "An ORDERED directive without the DEPEND clause must be closely "
1326 "ORDERED clause without the parameter"_err_en_US);
1369 // 2.7.2 end-sections -> END SECTIONS [nowait-clause]
1382 // constructs unless a nowait clause is specified. Only OMPD_end_sections is
1515 // If the destroy clause appears on a depobj construct, destroy-var must
1517 auto &clause{std::get<parser::OmpClause>(x.t)};
1518 if (clause.Id() == llvm::omp::Clause::OMPC_destroy) {
1524 auto &wrapper{std::get<parser::OmpClause::Destroy>(clause.u)};
1532 "The DESTROY clause must refer to the same object as the "
1552 void OmpStructureChecker::CheckAlignValue(const parser::OmpClause &clause) {
1553 if (auto *align{std::get_if<parser::OmpClause::Align>(&clause.u)}) {
1555 context_.Say(clause.source,
1567 for (const auto &clause : clauseList.v) {
1568 CheckAlignValue(clause);
1627 "If the DECLARE TARGET directive has a clause, it must contain at least one ENTER clause or LINK clause"_err_en_US);
1632 "The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead."_warn_en_US);
1697 "The given %s directive clause has an invalid argument"_err_en_US,
1705 "The given %s directive clause has an invalid argument"_err_en_US,
1718 // - Extended list: It behaves as if there was an ENTER/TO clause with the
1730 for (const auto &clause : clauseList->v) {
1762 clause.u);
1827 for (const auto &clause : clauseList.v) {
1828 CheckAlignValue(clause);
1848 for (const auto &clause : clauseList.v) {
1850 parser::Unwrap<parser::OmpClause::Allocate>(clause)}) {
1860 for (const auto &clause : clauseList.v) {
1862 std::get_if<parser::OmpClause::Allocate>(&clause.u)}) {
1874 "Exactly one of EXCLUSIVE or INCLUSIVE clause is expected"_err_en_US);
1929 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_depend)) {
1930 const auto &dependClause{std::get<parser::OmpClause::Depend>(clause->u)};
1932 visitDoacross(*doAcross, clause->source);
1934 context_.Say(clause->source,
1938 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_doacross)) {
1939 auto &doaClause{std::get<parser::OmpClause::Doacross>(clause->u)};
1940 visitDoacross(doaClause.v.v, clause->source);
1946 if (const auto *clause{
1949 std::get<parser::OmpClause::Ordered>(clause->u)};
1961 "An ORDERED construct with the DEPEND clause must be closely nested "
1963 "ORDERED clause with a parameter"_err_en_US);
1975 "The number of variables in the SINK iteration vector does not match the parameter specified in ORDERED clause"_err_en_US);
1979 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_depend)) {
1980 auto &dependClause{std::get<parser::OmpClause::Depend>(clause->u)};
1982 visitDoacross(*doAcross, clause->source);
1985 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_doacross)) {
1986 auto &doaClause{std::get<parser::OmpClause::Doacross>(clause->u)};
1987 visitDoacross(doaClause.v.v, clause->source);
1997 "At least one motion-clause (TO/FROM) must be specified on "
2013 "A list item ('%s') can only appear in a TO or FROM clause, but not in both."_err_en_US,
2015 context_.Say(source, "'%s' appears in the TO clause."_because_en_US,
2018 "'%s' appears in the FROM clause."_because_en_US,
2119 "If memory-order-clause is RELEASE, ACQUIRE, or ACQ_REL, list items "
2170 "Hint clause other than omp_sync_hint_none cannot be specified for "
2197 // If construct-type-clause is taskgroup, the cancellation construct must be
2200 // construct-type-clause is sections, the cancellation construct must be
2203 // that matches the type specified in construct-type-clause of the
2233 "With %s clause, %s construct must be closely nested inside TASK "
2262 "With %s clause, %s construct cannot be closely nested inside %s "
2291 "the construct that matches the DO clause type"_err_en_US,
2299 "the construct that matches the PARALLEL clause type"_err_en_US,
2315 // 2.7.3 end-single-clause -> copyprivate-clause |
2316 // nowait-clause
2320 // 2.7.4 end-workshare -> END WORKSHARE [nowait-clause]
2333 // constructs unless a nowait clause is specified. Only OMPD_end_single and
2590 // TODO: Allow cond-update-stmt once compare clause is supported.
2647 for (const auto &clause : clauseList->v) {
2648 if (std::get_if<parser::OmpFailClause>(&clause.u)) {
2651 context_.Say(clause.source,
2652 "More than one FAIL clause not allowed on OpenMP ATOMIC construct"_err_en_US);
2656 if (std::get_if<parser::OmpMemoryOrderClause>(&clause.u)) {
2659 context_.Say(clause.source,
2660 "More than one memory order clause not allowed on OpenMP ATOMIC construct"_err_en_US);
2769 if (auto *clause{FindClause(llvm::omp::Clause::OMPC_schedule)}) {
2770 // only one schedule clause is allowed
2771 const auto &schedClause{std::get<parser::OmpClause::Schedule>(clause->u)};
2778 context_.Say(clause->source,
2780 "if an ORDERED clause is specified"_err_en_US);
2785 if (auto *clause{FindClause(llvm::omp::Clause::OMPC_ordered)}) {
2786 // only one ordered clause is allowed
2788 std::get<parser::OmpClause::Ordered>(clause->u)};
2801 context_.Say(clause->source,
2802 "The parameter of the ORDERED clause must be "
2804 "the parameter of the COLLAPSE clause"_err_en_US);
2817 if (auto *clause{FindClause(llvm::omp::Clause::OMPC_simdlen)}) {
2820 std::get<parser::OmpClause::Simdlen>(clause->u)};
2827 context_.Say(clause->source,
2828 "The parameter of the SIMDLEN clause must be less than or "
2829 "equal to the parameter of the SAFELEN clause"_err_en_US);
2844 "The `SAFELEN` clause cannot appear in the `SIMD` directive "
2845 "with `ORDER(CONCURRENT)` clause"_err_en_US);
2852 // clause
2865 "A THREADPRIVATE variable cannot be in %s clause"_err_en_US,
2876 const auto *clause = it.second;
2878 if (const auto *objList{GetOmpObjectList(*clause)}) {
3035 assert(!isFailClause && "Unexpected FAIL clause inside a FAIL clause?");
3041 assert(isFailClause && "Expected to be inside a FAIL clause here");
3046 assert(!isFailClause && "Unexpected FAIL clause inside a FAIL clause?");
3052 assert(isFailClause && "Expected to be inside a FAIL clause here");
3056 // Restrictions specific to each clause are implemented apart from the
3069 "The object parameter in DESTROY clause on DEPOPJ construct is not allowed in %s, %s"_warn_en_US,
3075 "The DESTROY clause without argument on DEPOBJ construct is deprecated in %s"_warn_en_US,
3162 "The minus reduction operator is deprecated since OpenMP 5.2 and is not supported in the REDUCTION clause."_err_en_US,
3169 context_.Say(source, "Invalid reduction operator in %s clause."_err_en_US,
3184 "Invalid reduction identifier in %s clause."_err_en_US,
3222 "Common block names are not allowed in %s clause"_err_en_US,
3238 "The base expression of an array element or section in %s clause must be an identifier"_err_en_US,
3249 "Type parameter inquiry is not permitted in %s clause"_err_en_US,
3270 // reduction clause must be valid for the combiner expression
3302 // reduction clause must be valid for the combiner expression
3354 // If a reduction-modifier is specified in a reduction clause that
3367 // "single" and "workshare" don't allow reduction clause,
3373 "Modifier 'TASK' on REDUCTION clause is only allowed with "
3383 "Modifier 'INSCAN' on REDUCTION clause is only allowed with "
3391 "Unexpected modifier on REDUCTION clause"_err_en_US);
3415 const auto *clause = it.second;
3417 if (const auto *objList{GetOmpObjectList(*clause)}) {
3452 // the parameter of ordered clause is optional
3458 "No ORDERED clause with a parameter can be specified "
3483 "%s clause is not allowed on the OMP %s directive,"
3514 llvm::StringRef clause) {
3540 "%s clause"_err_en_US,
3541 clause.data());
3595 llvmOmpClause clause, const parser::OmpObjectList &ompObjectList) {
3600 "DO iteration variable %s is not allowed in %s clause."_err_en_US,
3602 parser::ToUpperCaseLetters(getClauseName(clause).str()));
3608 // Atomic-clause
3629 // OmpAtomic node represents atomic directive without atomic-clause.
3630 // atomic-clause - READ,WRITE,UPDATE,CAPTURE.
3632 if (const auto *clause{FindClause(llvm::omp::Clause::OMPC_acquire)}) {
3633 context_.Say(clause->source,
3636 if (const auto *clause{FindClause(llvm::omp::Clause::OMPC_acq_rel)}) {
3637 context_.Say(clause->source,
3642 // Restrictions specific to each clause are implemented apart from the
3810 "A modifier may not be specified in a LINEAR clause on the %s directive"_err_en_US,
3845 // OpenMP 5.2: Ordered clause restriction
3846 if (const auto *clause{
3848 const auto &orderedClause{std::get<parser::OmpClause::Ordered>(clause->u)};
3854 // OpenMP 5.2: Linear clause Restrictions
3867 "The list item `%s` in a LINEAR clause must not be Cray Pointer or a variable with POINTER attribute"_err_en_US,
3872 "'%s' is a common block name and must not appear in an LINEAR clause"_err_en_US,
3909 "'MAP' clause has been deprecated in OpenMP 5.2"_port_en_US);
3975 "When SCHEDULE clause has %s specified, "
4019 "The ANCESTOR %s must not appear on the DEVICE clause on any directive other than the TARGET construct. Found on %s construct."_err_en_US,
4034 "Unexpected alternative in update clause");
4045 // A depend clause on a depobj construct must not have source, sink [or
4059 "A DEPEND clause on a DEPOBJ construct must not have %s as dependence type"_err_en_US,
4074 // A depend clause on a depobj construct must only specify one locator.
4077 "A DEPEND clause on a DEPOBJ construct must only specify "
4085 "clause"_err_en_US,
4105 "An iterator-modifier may specify multiple locators, a DEPEND clause on a DEPOBJ construct must only specify one locator"_warn_en_US);
4124 // which references a prior ORDERED(n) clause on a DO or SIMD construct
4174 // Omp-loop-construct, check if it's do/simd with an ORDERED clause.
4182 // If it has ORDERED clause, stop the traversal.
4200 SymbolSourceMap &symbols, const llvm::omp::Clause clause) {
4205 "If a polymorphic variable with allocatable attribute '%s' is in %s clause, the behavior is unspecified"_port_en_US,
4207 parser::ToUpperCaseLetters(getClauseName(clause).str()));
4222 "%s clause is not allowed on the OMP %s directive,"
4277 "A variable that is part of another variable cannot appear on the %s clause"_err_en_US,
4302 "Unexpected alternative in update clause");
4311 // An update clause on a depobj construct must not have source, sink or depobj
4326 "An UPDATE clause on a DEPOBJ construct must not have SINK, SOURCE or DEPOBJ as dependence type"_err_en_US);
4338 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_use_device_ptr)) {
4340 std::get<parser::OmpClause::UseDevicePtr>(clause->u)};
4347 context_.Warn(common::UsageWarning::OpenMPUsage, clause->source,
4357 listVars, useDevicePtrNameList, clause->source, "USE_DEVICE_PTR");
4367 for (auto [_, clause] :
4370 std::get<parser::OmpClause::UseDeviceAddr>(clause->u)};
4381 listVars, useDeviceAddrNameList, clause->source, "USE_DEVICE_ADDR");
4390 for (auto [_, clause] : FindClauses(llvm::omp::Clause::OMPC_is_device_ptr)) {
4392 std::get<parser::OmpClause::IsDevicePtr>(clause->u)};
4398 context_.Say(clause->source,
4399 "Variable '%s' in IS_DEVICE_PTR clause must be of type C_PTR"_err_en_US,
4402 context_.Warn(common::UsageWarning::OpenMPUsage, clause->source,
4403 "Variable '%s' in IS_DEVICE_PTR clause must be a dummy argument. "
4407 context_.Warn(common::UsageWarning::OpenMPUsage, clause->source,
4408 "Variable '%s' in IS_DEVICE_PTR clause must be a dummy argument "
4422 for (auto [_, clause] :
4425 std::get<parser::OmpClause::HasDeviceAddr>(clause->u)};
4494 // The "to" clause is only allowed on "declare target" (pre-5.1), and
4498 // The "declare target" construct (and the "to" clause on it) are already
4535 "%s clause is only allowed on combined TARGET TEAMS"_err_en_US,
4548 llvm::StringRef OmpStructureChecker::getClauseName(llvm::omp::Clause clause) {
4549 return llvm::omp::getOpenMPClauseName(clause);
4589 "clause"_err_en_US);
4593 "Coarrays are not supported in DEPEND clause"_err_en_US);
4600 // Called from both Reduction and Depend clause.
4603 const llvm::omp::Clause clause) {
4616 "'%s' in %s clause"
4619 parser::ToUpperCaseLetters(getClauseName(clause).str()));
4624 if (clause == llvm::omp::Clause::OMPC_depend) {
4628 "clause"_err_en_US);
4644 "Pointer '%s' with the INTENT(IN) attribute may not appear in a %s clause"_err_en_US,
4652 SymbolSourceMap &symbols, llvm::omp::Clause clause) {
4656 "Procedure pointer '%s' may not appear in a %s clause"_err_en_US,
4658 parser::ToUpperCaseLetters(getClauseName(clause).str()));
4664 const parser::OmpObjectList &objectList, llvm::StringRef clause,
4677 "Cray Pointee '%s' may not appear in %s clause%s"_err_en_US,
4678 symbol->name(), clause.str(), suggestionMsg);
4702 SymbolSourceMap &symbols, const llvm::omp::Clause clause) {
4708 "Variable '%s' on the %s clause is not definable"_err_en_US,
4710 parser::ToUpperCaseLetters(getClauseName(clause).str()))
4890 const parser::OmpClause &clause) {
4921 clause.u);
4962 void OmpStructureChecker::CheckAllowedRequiresClause(llvmOmpClause clause) {
4963 CheckAllowedClause(clause);
4965 if (clause != llvm::omp::Clause::OMPC_atomic_default_mem_order) {
4969 "REQUIRES directive with '%s' clause found lexically after device "
4971 parser::ToUpperCaseLetters(getClauseName(clause).str()));