[compiler-rt] r193108 - [lsan] When detect_leaks=false, be completely silent.
Sergey Matveev
earthdok at google.com
Mon Oct 21 12:35:00 PDT 2013
Author: smatveev
Date: Mon Oct 21 14:35:00 2013
New Revision: 193108
URL: http://llvm.org/viewvc/llvm-project?rev=193108&view=rev
Log:
[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.
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=193108&r1=193107&r2=193108&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Mon Oct 21 14:35:00 2013
@@ -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();
}
More information about the llvm-commits
mailing list