[clang] [OpenACC] Fix invalid routine case where 'bind' didn't exist (PR #192270)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 15 08:15:20 PDT 2026
================
@@ -2416,35 +2416,38 @@ void SemaOpenACC::CheckRoutineDecl(SourceLocation DirLoc,
}
auto BindItr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCBindClause>);
- for (auto *A : NextParsedFDecl->attrs()) {
- // OpenACC 3.3 2.15:
- // If a procedure has a bind clause on both the declaration and definition
- // than they both must bind to the same name.
- if (auto *RA = dyn_cast<OpenACCRoutineDeclAttr>(A)) {
- auto OtherBindItr =
- llvm::find_if(RA->Clauses, llvm::IsaPred<OpenACCBindClause>);
- if (OtherBindItr != RA->Clauses.end() &&
- (*cast<OpenACCBindClause>(*BindItr)) !=
- (*cast<OpenACCBindClause>(*OtherBindItr))) {
- Diag((*BindItr)->getBeginLoc(), diag::err_acc_duplicate_unnamed_bind);
- Diag((*OtherBindItr)->getEndLoc(), diag::note_acc_previous_clause_here)
- << (*BindItr)->getClauseKind();
- return;
+ if (BindItr != Clauses.end()) {
----------------
erichkeane wrote:
That would cause us to duplicate the code on 2454, which seemed like a worse decision than just tabbing in 1 more level.
https://github.com/llvm/llvm-project/pull/192270
More information about the cfe-commits
mailing list