Author: Vitaly Buka Date: 2020-12-29T17:28:31-08:00 New Revision: 9b25b8068df3b2f34938eea17749c72939131d84
URL: https://github.com/llvm/llvm-project/commit/9b25b8068df3b2f34938eea17749c72939131d84 DIFF: https://github.com/llvm/llvm-project/commit/9b25b8068df3b2f34938eea17749c72939131d84.diff LOG: [NFC][lsan] Extract PrintResults function Added: Modified: compiler-rt/lib/lsan/lsan_common.cpp Removed: ################################################################################ diff --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp index ac7536757743..77e7d85e8c9f 100644 --- a/compiler-rt/lib/lsan/lsan_common.cpp +++ b/compiler-rt/lib/lsan/lsan_common.cpp @@ -618,6 +618,28 @@ static void CheckForLeaksCallback(const SuspendedThreadsList &suspended_threads, param->success = true; } +static bool PrintResults(LeakReport &report) { + uptr unsuppressed_count = report.UnsuppressedLeakCount(); + if (unsuppressed_count) { + Decorator d; + Printf( + "\n" + "=================================================================" + "\n"); + Printf("%s", d.Error()); + Report("ERROR: LeakSanitizer: detected memory leaks\n"); + Printf("%s", d.Default()); + report.ReportTopLeaks(flags()->max_leaks); + } + if (common_flags()->print_suppressions) + GetSuppressionContext()->PrintMatchedSuppressions(); + if (unsuppressed_count > 0) { + report.PrintSummary(); + return true; + } + return false; +} + static bool CheckForLeaks() { if (&__lsan_is_turned_off && __lsan_is_turned_off()) return false; @@ -635,24 +657,7 @@ static bool CheckForLeaks() { Die(); } param.leak_report.ApplySuppressions(); - uptr unsuppressed_count = param.leak_report.UnsuppressedLeakCount(); - if (unsuppressed_count > 0) { - Decorator d; - Printf("\n" - "=================================================================" - "\n"); - Printf("%s", d.Error()); - Report("ERROR: LeakSanitizer: detected memory leaks\n"); - Printf("%s", d.Default()); - param.leak_report.ReportTopLeaks(flags()->max_leaks); - } - if (common_flags()->print_suppressions) - GetSuppressionContext()->PrintMatchedSuppressions(); - if (unsuppressed_count > 0) { - param.leak_report.PrintSummary(); - return true; - } - return false; + return PrintResults(param.leak_report); } static bool has_reported_leaks = false; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits