[clang] [OpenMP] Conditional modifier on lastprivate clause is producing incorrect result in C mode (PR #156004)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 03:51:42 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 origin/main HEAD --extensions c,cpp -- clang/test/OpenMP/for_lst_private_codegen_c.c clang/lib/CodeGen/CGExprScalar.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 62bf3fae0..ce483c5cc 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -5218,8 +5218,8 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
   }
   // OpenMP: Handle lastprivate(condition:) in scalar assignment
   if (CGF.getLangOpts().OpenMP) {
-      CGF.CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(CGF,
-                                                                    E->getLHS());
+    CGF.CGM.getOpenMPRuntime().checkAndEmitLastprivateConditional(CGF,
+                                                                  E->getLHS());
   }
 
   // If the result is clearly ignored, return now.

``````````

</details>


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


More information about the cfe-commits mailing list