[compiler-rt] [DataflowSanitizer] Use nullptr instead of NULL or 0 (PR #85986)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 20 11:41:18 PDT 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 891172d9be01dd7c7e5298f2d8fdb143add448da c1142da8557b5c32eef0b0122fee4552911b48ea -- compiler-rt/lib/dfsan/dfsan_allocator.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/dfsan/dfsan_allocator.cpp b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
index d382501eb9..282e523345 100644
--- a/compiler-rt/lib/dfsan/dfsan_allocator.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
@@ -91,47 +91,48 @@ void DFsanThreadLocalMallocStorage::CommitBack() {
static void *DFsanAllocate(uptr size, uptr alignment, bool zeroise) {
if (size > max_malloc_size) {
if (AllocatorMayReturnNull()) {
- Report("WARNING: DataflowSanitizer failed to allocate 0x%zx bytes\n",
- size);
- return nullptr;
-}
+ Report("WARNING: DataflowSanitizer failed to allocate 0x%zx bytes\n",
+ size);
+ return nullptr;
+ }
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (!p)
- return nullptr;
+ if (!p)
+ return nullptr;
-if (!beg)
- return nullptr;
+ if (!beg)
+ return nullptr;
-if (!b)
- return nullptr;
+ if (!b)
+ return nullptr;
-if (!ptr)
- return SetErrnoOnNull(DFsanAllocate(size, sizeof(u64), false /*zeroise*/));
-if (size == 0) {
- dfsan_deallocate(ptr);
- return nullptr;
-}
+ if (!ptr)
+ return SetErrnoOnNull(
+ DFsanAllocate(size, sizeof(u64), false /*zeroise*/));
+ if (size == 0) {
+ dfsan_deallocate(ptr);
+ return nullptr;
+ }
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
-if (AllocatorMayReturnNull())
- return nullptr;
+ if (AllocatorMayReturnNull())
+ return nullptr;
BufferedStackTrace stack;
ReportRssLimitExceeded(&stack);
``````````
</details>
https://github.com/llvm/llvm-project/pull/85986
More information about the llvm-commits
mailing list