https://github.com/zeyi2 created 
https://github.com/llvm/llvm-project/pull/187454

None

>From 8c77c71b14304f993d1669645f55251f75ee2af4 Mon Sep 17 00:00:00 2001
From: mtx <[email protected]>
Date: Wed, 18 Mar 2026 20:50:59 +0800
Subject: [PATCH 1/3] [flang][OpenACC] Fix crash on invalid clauses in WAIT and
 ATOMIC constructs

---
 flang/lib/Semantics/resolve-directives.cpp     | 18 ++++++++++++++++++
 .../Semantics/OpenACC/acc-atomic-validity.f90  |  6 +++++-
 .../Semantics/OpenACC/acc-wait-validity.f90    |  3 +++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index c8ffa22d6bb5f..f9e31b259db0d 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -239,6 +239,11 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor<llvm::acc::Directive> {
     GetContext().withinConstruct = true;
   }
 
+  bool Pre(const parser::OpenACCWaitConstruct &);
+  void Post(const parser::OpenACCWaitConstruct &) { PopContext(); }
+  bool Pre(const parser::OpenACCAtomicConstruct &);
+  void Post(const parser::OpenACCAtomicConstruct &) { PopContext(); }
+
   bool Pre(const parser::OpenACCCacheConstruct &);
   void Post(const parser::OpenACCCacheConstruct &) { PopContext(); }
 
@@ -1620,6 +1625,19 @@ void AccAttributeVisitor::AllowOnlyVariable(const 
parser::AccObject &object) {
       object.u);
 }
 
+bool AccAttributeVisitor::Pre(const parser::OpenACCWaitConstruct &x) {
+  const auto &verbatim{std::get<parser::Verbatim>(x.t)};
+  PushContext(verbatim.source, llvm::acc::Directive::ACCD_wait);
+  ClearDataSharingAttributeObjects();
+  return true;
+}
+
+bool AccAttributeVisitor::Pre(const parser::OpenACCAtomicConstruct &x) {
+  PushContext(x.source, llvm::acc::Directive::ACCD_atomic);
+  ClearDataSharingAttributeObjects();
+  return true;
+}
+
 bool AccAttributeVisitor::Pre(const parser::OpenACCCacheConstruct &x) {
   const auto &verbatim{std::get<parser::Verbatim>(x.t)};
   PushContext(verbatim.source, llvm::acc::Directive::ACCD_cache);
diff --git a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90 
b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
index 9f8450456586c..a833ee987f48f 100644
--- a/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-atomic-validity.f90
@@ -105,6 +105,10 @@ program openacc_atomic_validity
 
   !$acc end parallel
 
+  !ERROR: COPY clause is not allowed on the ATOMIC UPDATE COPY(I)
+  !$acc atomic update copy(i)
+  c(i) = c(i) + 1
+
 end program openacc_atomic_validity
 
 subroutine capture_with_convert_f64_to_i32()
@@ -147,4 +151,4 @@ subroutine capture_with_convert_f64_to_i32()
   v = x
   x = w * w
   !$acc end atomic
-end subroutine capture_with_convert_f64_to_i32
\ No newline at end of file
+end subroutine capture_with_convert_f64_to_i32
diff --git a/flang/test/Semantics/OpenACC/acc-wait-validity.f90 
b/flang/test/Semantics/OpenACC/acc-wait-validity.f90
index 25d603dad0502..c226751ce8b69 100644
--- a/flang/test/Semantics/OpenACC/acc-wait-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-wait-validity.f90
@@ -39,4 +39,7 @@ program openacc_wait_validity
   !ERROR: At most one ASYNC clause can appear on the WAIT directive
   !$acc wait(1) if(.true.) async(1) async
 
+  !ERROR: COPY clause is not allowed on the WAIT directive
+  !$acc wait copy(ifCondition)
+
 end program openacc_wait_validity

>From ffeec0d779ab540d77057fd48e10efc9cbf1c74d Mon Sep 17 00:00:00 2001
From: mtx <[email protected]>
Date: Wed, 18 Mar 2026 21:16:02 +0800
Subject: [PATCH 2/3] convention? better?

---
 flang/lib/Semantics/resolve-directives.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index f9e31b259db0d..4a6cdb34defd2 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1633,7 +1633,19 @@ bool AccAttributeVisitor::Pre(const 
parser::OpenACCWaitConstruct &x) {
 }
 
 bool AccAttributeVisitor::Pre(const parser::OpenACCAtomicConstruct &x) {
-  PushContext(x.source, llvm::acc::Directive::ACCD_atomic);
+  const auto &verbatimSource = common::visit(
+      common::visitors{
+          [&](const parser::AccAtomicUpdate &atomic) {
+            const auto &optVerbatim =
+                std::get<std::optional<parser::Verbatim>>(atomic.t);
+            return optVerbatim ? optVerbatim->source : x.source;
+          },
+          [&](const auto &atomic) {
+            return std::get<parser::Verbatim>(atomic.t).source;
+          },
+      },
+      x.u);
+  PushContext(verbatimSource, llvm::acc::Directive::ACCD_atomic);
   ClearDataSharingAttributeObjects();
   return true;
 }

>From 68fb72aadf9c1cec967bcb757953be8cc1bcb9bd Mon Sep 17 00:00:00 2001
From: mtx <[email protected]>
Date: Thu, 19 Mar 2026 15:58:26 +0800
Subject: [PATCH 3/3] [clang-tidy] DO NOT MERGE: Test that Windows CI can catch
 invalid JSON

---
 .../infrastructure/clang-tidy-store-check-profile-one-tu.cpp    | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-store-check-profile-one-tu.cpp
 
b/clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-store-check-profile-one-tu.cpp
index 192fbf546d203..9800881af9292 100644
--- 
a/clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-store-check-profile-one-tu.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-store-check-profile-one-tu.cpp
@@ -1,9 +1,11 @@
 // RUN: rm -rf %t.dir/out
 // RUN: clang-tidy -enable-check-profile 
-checks='-*,readability-function-size' -store-check-profile=%t.dir/out %s -- 
2>&1 | not FileCheck --match-full-lines 
-implicit-check-not='{{warning:|error:}}' -check-prefix=CHECK-CONSOLE %s
 // RUN: cat %t.dir/out/*-clang-tidy-store-check-profile-one-tu.cpp.json | 
FileCheck --match-full-lines -implicit-check-not='{{warning:|error:}}' 
-check-prefix=CHECK-FILE %s
+// RUN: cat %t.dir/out/*-clang-tidy-store-check-profile-one-tu.cpp.json | 
%python -c "import sys, json; json.load(sys.stdin)"
 // RUN: rm -rf %t.dir/out
 // RUN: clang-tidy -enable-check-profile 
-checks='-*,readability-function-size' -store-check-profile=%t.dir/out %s -- 
2>&1
 // RUN: cat %t.dir/out/*-clang-tidy-store-check-profile-one-tu.cpp.json | 
FileCheck --match-full-lines -implicit-check-not='{{warning:|error:}}' 
-check-prefix=CHECK-FILE %s
+// RUN: cat %t.dir/out/*-clang-tidy-store-check-profile-one-tu.cpp.json | 
%python -c "import sys, json; json.load(sys.stdin)"
 
 // CHECK-CONSOLE-NOT: 
===-------------------------------------------------------------------------===
 // CHECK-CONSOLE-NOT: {{.*}}  --- Name ---

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to