forked from OSchip/llvm-project
[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. llvm-svn: 193108
This commit is contained in:
parent
bbd24901cf
commit
fd10073aeb
|
@ -93,8 +93,12 @@ void InitializeSuppressions() {
|
||||||
|
|
||||||
void InitCommonLsan() {
|
void InitCommonLsan() {
|
||||||
InitializeFlags();
|
InitializeFlags();
|
||||||
InitializeSuppressions();
|
if (common_flags()->detect_leaks) {
|
||||||
InitializePlatformSpecificModules();
|
// Initialization which can fail or print warnings should only be done if
|
||||||
|
// LSan is actually enabled.
|
||||||
|
InitializeSuppressions();
|
||||||
|
InitializePlatformSpecificModules();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Decorator: private __sanitizer::AnsiColorDecorator {
|
class Decorator: private __sanitizer::AnsiColorDecorator {
|
||||||
|
@ -537,6 +541,8 @@ extern "C" {
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE
|
SANITIZER_INTERFACE_ATTRIBUTE
|
||||||
void __lsan_ignore_object(const void *p) {
|
void __lsan_ignore_object(const void *p) {
|
||||||
#if CAN_SANITIZE_LEAKS
|
#if CAN_SANITIZE_LEAKS
|
||||||
|
if (!common_flags()->detect_leaks)
|
||||||
|
return;
|
||||||
// Cannot use PointsIntoChunk or LsanMetadata here, since the allocator is not
|
// Cannot use PointsIntoChunk or LsanMetadata here, since the allocator is not
|
||||||
// locked.
|
// locked.
|
||||||
BlockingMutexLock l(&global_mutex);
|
BlockingMutexLock l(&global_mutex);
|
||||||
|
@ -561,7 +567,7 @@ void __lsan_disable() {
|
||||||
SANITIZER_INTERFACE_ATTRIBUTE
|
SANITIZER_INTERFACE_ATTRIBUTE
|
||||||
void __lsan_enable() {
|
void __lsan_enable() {
|
||||||
#if CAN_SANITIZE_LEAKS
|
#if CAN_SANITIZE_LEAKS
|
||||||
if (!__lsan::disable_counter) {
|
if (!__lsan::disable_counter && common_flags()->detect_leaks) {
|
||||||
Report("Unmatched call to __lsan_enable().\n");
|
Report("Unmatched call to __lsan_enable().\n");
|
||||||
Die();
|
Die();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue