[clang] [compiler-rt] [NFC] Size and element numbers are often swapped when calling calloc (PR #79081)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 17:49:22 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 d4933b3241f463871cae55bbeec8563e7ffe03a2 bda35bd77adc4b137a8e9c8dab1f58f233db6c7c -- clang/test/CodeGen/alloc-size.c compiler-rt/lib/profile/InstrProfilingFile.c compiler-rt/test/tsan/java_finalizer2.cpp
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/test/tsan/java_finalizer2.cpp b/compiler-rt/test/tsan/java_finalizer2.cpp
index d230c4e2b0..0d677be2ba 100644
--- a/compiler-rt/test/tsan/java_finalizer2.cpp
+++ b/compiler-rt/test/tsan/java_finalizer2.cpp
@@ -51,7 +51,7 @@ void *Ballast(void *p) {
 }
 
 int main() {
-  Heap* heap = (Heap*)calloc(2, sizeof(Heap)) + 1;
+  Heap *heap = (Heap *)calloc(2, sizeof(Heap)) + 1;
   __tsan_java_init((jptr)heap, sizeof(*heap));
   __tsan_java_alloc((jptr)heap, sizeof(*heap));
   // Ballast threads merely make the bug a bit easier to trigger.

``````````

</details>


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


More information about the llvm-commits mailing list