diff options
| author | Sergey Matveev <earthdok@google.com> | 2013-10-21 19:35:00 +0000 |
|---|---|---|
| committer | Sergey Matveev <earthdok@google.com> | 2013-10-21 19:35:00 +0000 |
| commit | 137a9b84c25f1ad7d68a14f138cf270a03a738cb (patch) | |
| tree | e7ac400392b68b3d93bb4c408cd423e171dbb6db | |
| parent | 5e7ba22755b994e4f6aaf8cc00773c4d1b8dbf07 (diff) | |
| download | compiler-rt-137a9b84c25f1ad7d68a14f138cf270a03a738cb.tar.gz compiler-rt-137a9b84c25f1ad7d68a14f138cf270a03a738cb.tar.bz2 compiler-rt-137a9b84c25f1ad7d68a14f138cf270a03a738cb.tar.xz | |
[lsan] When detect_leaks=false, be completely silent.
In particular, don't make a fuss if we're passed a malformed suppressions file,
or if we have trouble identifying ld.so. Also, make LSan interface functions
no-ops in this case.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193108 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/lsan/lsan_common.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc index ec914979..d423e067 100644 --- a/lib/lsan/lsan_common.cc +++ b/lib/lsan/lsan_common.cc @@ -93,8 +93,12 @@ void InitializeSuppressions() { void InitCommonLsan() { InitializeFlags(); - InitializeSuppressions(); - InitializePlatformSpecificModules(); + if (common_flags()->detect_leaks) { + // Initialization which can fail or print warnings should only be done if + // LSan is actually enabled. + InitializeSuppressions(); + InitializePlatformSpecificModules(); + } } class Decorator: private __sanitizer::AnsiColorDecorator { @@ -537,6 +541,8 @@ extern "C" { SANITIZER_INTERFACE_ATTRIBUTE void __lsan_ignore_object(const void *p) { #if CAN_SANITIZE_LEAKS + if (!common_flags()->detect_leaks) + return; // Cannot use PointsIntoChunk or LsanMetadata here, since the allocator is not // locked. BlockingMutexLock l(&global_mutex); @@ -561,7 +567,7 @@ void __lsan_disable() { SANITIZER_INTERFACE_ATTRIBUTE void __lsan_enable() { #if CAN_SANITIZE_LEAKS - if (!__lsan::disable_counter) { + if (!__lsan::disable_counter && common_flags()->detect_leaks) { Report("Unmatched call to __lsan_enable().\n"); Die(); } |
