[clang] [OpenACC] Fix invalid routine case where 'bind' didn't exist (PR #192270)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 09:48:10 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()) {
----------------
ojhunt wrote:

That's fair

Though you could undertake a giant refactor to make a it a method ("extract as method": 1 function, 500 parameters!) :D

https://github.com/llvm/llvm-project/pull/192270


More information about the cfe-commits mailing list