[compiler-rt] r186819 - [lsan] Print direct leaks first.
Sergey Matveev
earthdok at google.com
Mon Jul 22 04:18:32 PDT 2013
Author: smatveev
Date: Mon Jul 22 06:18:32 2013
New Revision: 186819
URL: http://llvm.org/viewvc/llvm-project?rev=186819&view=rev
Log:
[lsan] Print direct leaks first.
Direct leaks are higher priority, so it makes sense to have them on top.
Modified:
compiler-rt/trunk/lib/lsan/lsan_common.cc
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=186819&r1=186818&r2=186819&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Mon Jul 22 06:18:32 2013
@@ -438,8 +438,11 @@ void LeakReport::Add(u32 stack_trace_id,
leaks_.push_back(leak);
}
-static bool IsLarger(const Leak &leak1, const Leak &leak2) {
- return leak1.total_size > leak2.total_size;
+static bool LeakComparator(const Leak &leak1, const Leak &leak2) {
+ if (leak1.is_directly_leaked == leak2.is_directly_leaked)
+ return leak1.total_size > leak2.total_size;
+ else
+ return leak1.is_directly_leaked;
}
void LeakReport::PrintLargest(uptr num_leaks_to_print) {
@@ -455,7 +458,7 @@ void LeakReport::PrintLargest(uptr num_l
if (!leaks_[i].is_suppressed) unsuppressed_count++;
if (num_leaks_to_print > 0 && num_leaks_to_print < unsuppressed_count)
Printf("The %zu largest leak(s):\n", num_leaks_to_print);
- InternalSort(&leaks_, leaks_.size(), IsLarger);
+ InternalSort(&leaks_, leaks_.size(), LeakComparator);
uptr leaks_printed = 0;
for (uptr i = 0; i < leaks_.size(); i++) {
if (leaks_[i].is_suppressed) continue;
More information about the llvm-commits
mailing list