[llvm-branch-commits] [compiler-rt] [lsan] Add debug option to "deflake" leaks (PR #112037)
Vitaly Buka via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Oct 11 12:43:33 PDT 2024
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 <vitalybuka at google.com>
Date: Fri, 11 Oct 2024 12:43:17 -0700
Subject: [PATCH] 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);
}
More information about the llvm-branch-commits
mailing list