llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Zeyi Xu (zeyi2)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/187454.diff


4 Files Affected:

- (modified) 
clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-store-check-profile-one-tu.cpp
 (+2) 
- (modified) flang/lib/Semantics/resolve-directives.cpp (+30) 
- (modified) flang/test/Semantics/OpenACC/acc-atomic-validity.f90 (+5-1) 
- (modified) flang/test/Semantics/OpenACC/acc-wait-validity.f90 (+3) 


``````````diff
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 ---
diff --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index c8ffa22d6bb5f..4a6cdb34defd2 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,31 @@ 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) {
+  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;
+}
+
 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

``````````

</details>


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

Reply via email to