[clang] [llvm] [Clang][Unittest] Support for `target` directive and `from` clause in clang unittests (PR #150580)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 00:27:15 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp,c -- offload/test/offloading/strided_update.c clang/include/clang/ASTMatchers/ASTMatchers.h clang/lib/ASTMatchers/ASTMatchersInternal.cpp clang/lib/ASTMatchers/Dynamic/Registry.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/offload/test/offloading/strided_update.c b/offload/test/offloading/strided_update.c
index 271a00de5..c223e159c 100644
--- a/offload/test/offloading/strided_update.c
+++ b/offload/test/offloading/strided_update.c
@@ -1,33 +1,34 @@
-// Checks that "update from" clause in OpenMP is supported when the elements are updated in a non-contiguous manner.
-// RUN: %libomptarget-compile-run-and-check-generic
-#include <omp.h>
-#include <stdio.h>
-
-int main() {
- int len = 8;
- double data[len];
- #pragma omp target map(tofrom: len, data[0:len])
- {
- for (int i = 0; i < len; i++) {
- data[i] = i;
- }
- }
- // initial values
- printf("original host array values:\n");
- for (int i = 0; i < len; i++)
- printf("%f\n", data[i]);
- printf("\n");
-
- #pragma omp target data map(to: len, data[0:len])
- {
- #pragma omp target
- for (int i = 0; i < len; i++) {
- data[i] += i ;
- }
-
- #pragma omp target update from(data[0:8:2])
- }
- // from results
+// Checks that "update from" clause in OpenMP is supported when the elements are
+// updated in a non-contiguous manner. RUN:
+// %libomptarget-compile-run-and-check-generic
+#include <omp.h>
+#include <stdio.h>
+
+int main() {
+ int len = 8;
+ double data[len];
+#pragma omp target map(tofrom : len, data[0 : len])
+ {
+ for (int i = 0; i < len; i++) {
+ data[i] = i;
+ }
+ }
+ // initial values
+ printf("original host array values:\n");
+ for (int i = 0; i < len; i++)
+ printf("%f\n", data[i]);
+ printf("\n");
+
+#pragma omp target data map(to : len, data[0 : len])
+ {
+#pragma omp target
+ for (int i = 0; i < len; i++) {
+ data[i] += i;
+ }
+
+#pragma omp target update from(data[0 : 8 : 2])
+ }
+ // from results
// CHECK: 0.000000
// CHECK: 1.000000
// CHECK: 4.000000
@@ -41,10 +42,10 @@ int main() {
// CHECK-NOT: 10.000000
// CHECK-NOT: 14.000000
- printf("from target array results:\n");
- for (int i = 0; i < len; i++)
- printf("%f\n", data[i]);
- printf("\n");
-
- return 0;
-}
+ printf("from target array results:\n");
+ for (int i = 0; i < len; i++)
+ printf("%f\n", data[i]);
+ printf("\n");
+
+ return 0;
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/150580
More information about the llvm-commits
mailing list