[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #120449)

via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 18 08:32:56 PST 2024


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 f8d270474c14c6705c77971494505dbe4b6d55ae 061b665db29b12f15cf3fee76c8e124d07ff050d --extensions cpp,c -- clang/test/CodeGen/atomic-test-and-set.c clang/lib/AST/Expr.cpp clang/lib/CodeGen/CGAtomic.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Sema/SemaChecking.cpp clang/test/Sema/atomic-ops.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8597b346b2..324ed7f6d9 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3694,8 +3694,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
   } Form = Init;
 
   const unsigned NumForm = Clear + 1;
-  const unsigned NumArgs[] = { 2, 2, 3, 3, 3, 3, 4, 5, 6, 2, 2 };
-  const unsigned NumVals[] = { 1, 0, 1, 1, 1, 1, 2, 2, 3, 0, 0 };
+  const unsigned NumArgs[] = {2, 2, 3, 3, 3, 3, 4, 5, 6, 2, 2};
+  const unsigned NumVals[] = {1, 0, 1, 1, 1, 1, 2, 2, 3, 0, 0};
   // where:
   //   C is an appropriate type,
   //   A is volatile _Atomic(C) for __c11 builtins and is C for GNU builtins,
@@ -4009,8 +4009,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
   ValType.removeLocalVolatile();
   ValType.removeLocalConst();
   QualType ResultType = ValType;
-  if (Form == Copy || Form == LoadCopy || Form == GNUXchg ||
-      Form == Init || Form == Clear)
+  if (Form == Copy || Form == LoadCopy || Form == GNUXchg || Form == Init ||
+      Form == Clear)
     ResultType = Context.VoidTy;
   else if (Form == C11CmpXchg || Form == GNUCmpXchg || Form == TestAndSet)
     ResultType = Context.BoolTy;

``````````

</details>


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


More information about the cfe-commits mailing list