https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/112037
>From abee2b641366897f8905ac61c49ac70d2a4d2a99 Mon Sep 17 00:00:00 2001 From: Vitaly Buka <vitalyb...@google.com> Date: Fri, 11 Oct 2024 12:43:17 -0700 Subject: [PATCH 1/2] format Created using spr 1.3.4 --- compiler-rt/lib/lsan/lsan_common.cpp | 3 +-- compiler-rt/lib/lsan/lsan_flags.inc | 3 ++- compiler-rt/test/lsan/TestCases/flag_retries.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index 8ed2cfc63cbae9..c53e1e610054bf 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 59edc0baa77d85..ae6057f171b825 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 3891a47bb0a566..de814bcab446c5 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); } >From 7a0b416c87601910e51525d5481f8921fd5eb31a Mon Sep 17 00:00:00 2001 From: Vitaly Buka <vitalyb...@google.com> Date: Fri, 11 Oct 2024 14:39:29 -0700 Subject: [PATCH 2/2] tries Created using spr 1.3.4 --- compiler-rt/lib/lsan/lsan_common.cpp | 6 +++--- compiler-rt/lib/lsan/lsan_flags.inc | 3 +-- .../test/lsan/TestCases/{flag_retries.c => flag_tries.c} | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) rename compiler-rt/test/lsan/TestCases/{flag_retries.c => flag_tries.c} (90%) diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index c53e1e610054bf..c05e0dd0a9332d 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -832,9 +832,9 @@ static bool CheckForLeaksOnce() { } static bool CheckForLeaks() { - int with_leaks = 0; - for (int i = 0; i < flags()->retries; ++i) with_leaks += CheckForLeaksOnce(); - return with_leaks == flags()->retries; + int leaking_tries = 0; + for (int i = 0; i < flags()->tries; ++i) leaking_tries += CheckForLeaksOnce(); + return leaking_tries == flags()->tries; } static bool has_reported_leaks = false; diff --git a/compiler-rt/lib/lsan/lsan_flags.inc b/compiler-rt/lib/lsan/lsan_flags.inc index ae6057f171b825..c97b021ba5c02f 100644 --- a/compiler-rt/lib/lsan/lsan_flags.inc +++ b/compiler-rt/lib/lsan/lsan_flags.inc @@ -43,8 +43,7 @@ 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, tries, 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_tries.c similarity index 90% rename from compiler-rt/test/lsan/TestCases/flag_retries.c rename to compiler-rt/test/lsan/TestCases/flag_tries.c index de814bcab446c5..d6af766d5ef282 100644 --- a/compiler-rt/test/lsan/TestCases/flag_retries.c +++ b/compiler-rt/test/lsan/TestCases/flag_tries.c @@ -1,7 +1,7 @@ // Test retries option of lsan. // RUN: %clang_lsan %s -o %t // RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0 %run %t foo 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK1 -// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0:retries=12 %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK12 +// RUN: %env_lsan_opts=use_stacks=0:use_registers=0:symbolize=0:tries=12 %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK12 #include <assert.h> #include <sanitizer/lsan_interface.h> _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits