[llvm-branch-commits] [lsan] Add debug option to "deflake" leaks (PR #112037)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Oct 11 12:25:05 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 5c25ba3380966ccac5bd0caf2c39bc10c1571e42 e88d91ffd1358f0c9cbd4fca14fc54a441fe2c36 --extensions inc,c,cpp -- compiler-rt/test/lsan/TestCases/flag_retries.c compiler-rt/lib/lsan/lsan_common.cpp compiler-rt/lib/lsan/lsan_flags.inc
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 8ed2cfc63c..c53e1e6100 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -833,8 +833,7 @@ static bool CheckForLeaksOnce() {
static bool CheckForLeaks() {
int with_leaks = 0;
- for (int i = 0; i < flags()->retries; ++i)
- with_leaks += CheckForLeaksOnce();
+ for (int i = 0; i < flags()->retries; ++i) with_leaks += CheckForLeaksOnce();
return with_leaks == flags()->retries;
}
diff --git a/compiler-rt/lib/lsan/lsan_flags.inc b/compiler-rt/lib/lsan/lsan_flags.inc
index 59edc0baa7..ae6057f171 100644
--- a/compiler-rt/lib/lsan/lsan_flags.inc
+++ b/compiler-rt/lib/lsan/lsan_flags.inc
@@ -43,7 +43,8 @@ LSAN_FLAG(bool, use_poisoned, false,
"Consider pointers found in poisoned memory to be valid.")
LSAN_FLAG(bool, log_pointers, false, "Debug logging")
LSAN_FLAG(bool, log_threads, false, "Debug logging")
-LSAN_FLAG(int, retries, 1, "Debug option to repeat leak checking multiple times")
+LSAN_FLAG(int, retries, 1,
+ "Debug option to repeat leak checking multiple times")
LSAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
LSAN_FLAG(int, thread_suspend_fail, 1,
"Behaviour if thread suspendion all thread (0 - "
diff --git a/compiler-rt/test/lsan/TestCases/flag_retries.c b/compiler-rt/test/lsan/TestCases/flag_retries.c
index 3891a47bb0..de814bcab4 100644
--- a/compiler-rt/test/lsan/TestCases/flag_retries.c
+++ b/compiler-rt/test/lsan/TestCases/flag_retries.c
@@ -4,20 +4,20 @@
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0:retries=12 %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK12
#include <assert.h>
+#include <sanitizer/lsan_interface.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sanitizer/lsan_interface.h>
void *p;
int main(int argc, char *argv[]) {
fprintf(stderr, "Test alloc: %p.\n", malloc(1337));
-// CHECK: Test alloc:
+ // CHECK: Test alloc:
assert(__lsan_do_recoverable_leak_check() == 1);
-// CHECK1-COUNT-1: SUMMARY: {{.*}}Sanitizer: 1337 byte
-// CHECK12-COUNT-12: SUMMARY: {{.*}}Sanitizer: 1337 byte
+ // CHECK1-COUNT-1: SUMMARY: {{.*}}Sanitizer: 1337 byte
+ // CHECK12-COUNT-12: SUMMARY: {{.*}}Sanitizer: 1337 byte
_exit(0);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/112037
More information about the llvm-branch-commits
mailing list