================
@@ -7938,46 +7990,108 @@ void SemaOpenMP::ActOnOpenMPDeclareVariantDirective(
}
}
- // OpenMP 5.1 [2.3.5, declare variant directive, Restrictions]
- // Each argument can only appear in a single adjust_args clause for each
- // declare variant directive.
- llvm::SmallPtrSet<const VarDecl *, 4> AdjustVars;
+ // OpenMP 6.0 [5.2.1]: each parameter list item may be specified only once
+ // per directive. The subject is the item, so a range is exempt and a name
+ // does not collide with a position that resolves to the same parameter.
+ llvm::SmallPtrSet<const VarDecl *, 4> AdjustVars; // named items
+ llvm::SmallSet<uint64_t, 4> AdjustPositions; // literal positional items
- for (Expr *E : AllAdjustArgs) {
- E = E->IgnoreParenImpCasts();
- if (const auto *DRE = dyn_cast<DeclRefExpr>(E)) {
- if (const auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl())) {
- const VarDecl *CanonPVD = PVD->getCanonicalDecl();
- if (FD->getNumParams() > PVD->getFunctionScopeIndex() &&
- FD->getParamDecl(PVD->getFunctionScopeIndex())
- ->getCanonicalDecl() == CanonPVD) {
- // It's a parameter of the function, check duplicates.
- if (!AdjustVars.insert(CanonPVD).second) {
- Diag(DRE->getLocation(), diag::err_omp_adjust_arg_multiple_clauses)
- << PVD;
+ for (const OMPAdjustArgsClause *Clause : AdjustArgs) {
+ for (const OMPAdjustArgsItem &ItemInfo : Clause->items()) {
----------------
alexey-bataev wrote:
```suggestion
if (Clause->NeedDevicePtrModifier != OMPC_NEED_DEVICE_PTR_unknown &&
Clause->AdjustOp != OMPC_ADJUST_ARGS_need_device_ptr) {
Diag(AdjustArgsLoc, diag::err_omp_unexpected_clause_modifier)
<< getOpenMPClauseName(OMPC_adjust_args);
return;
}
for (const OMPAdjustArgsItem &ItemInfo : Clause->items()) {
```
https://github.com/llvm/llvm-project/pull/225081
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits