[lsan] Ignore inderect leaks referenced by suppressed blocks
authorVitaly Buka <vitalybuka@google.com>
Tue, 29 Dec 2020 03:19:38 +0000 (19:19 -0800)
committerVitaly Buka <vitalybuka@google.com>
Thu, 31 Dec 2020 03:11:39 +0000 (19:11 -0800)
commit9a0237011b7e9e8111757365d1cb322fbbb086ae
tree76571f53bbe14d0a3e9aff09dfad69afbbfb6525
parent6be0b9a8ddca0b2c937b31e0ee33fcbb7eb03dda
[lsan] Ignore inderect leaks referenced by suppressed blocks

This makes suppression list to work similar to __lsan_ignore_object.

Existing behavior was inconsistent and very inconvenient for complex
data structures.

Example:

struct B;
struct A { B* ptr; };
A* t = makeA();
t->ptr = makeB();

Before the patch: if makeA suppressed by suppression file, lsan will
still report the makeB() leak, so we need two suppressions.

After the patch: a single makeA suppression is enough (the same as a
single __lsan_ignore_object(t)).

Differential Revision: https://reviews.llvm.org/D93884
compiler-rt/lib/lsan/lsan_common.cpp
compiler-rt/lib/lsan/lsan_common.h
compiler-rt/test/lsan/TestCases/suppressions_file.cpp