Skip to content

Commit c96d0cc

Browse files
committed
asan: Use #if to test CAN_SANITIZE_LEAKS
The `if (0)` isn't necessarily optimized out so as not to create a link-time reference to LSan runtime functions that might not exist. So use explicit conditional compilation instead. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D88173
1 parent 652a8f1 commit c96d0cc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler-rt/lib/asan/asan_rtl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,10 @@ static void AsanInitInternal() {
498498
force_interface_symbols(); // no-op.
499499
SanitizerInitializeUnwinder();
500500

501-
if (CAN_SANITIZE_LEAKS) {
502-
__lsan::InitCommonLsan();
503-
InstallAtExitCheckLeaks();
504-
}
501+
#if CAN_SANITIZE_LEAKS
502+
__lsan::InitCommonLsan();
503+
InstallAtExitCheckLeaks();
504+
#endif
505505

506506
#if CAN_SANITIZE_UB
507507
__ubsan::InitAsPlugin();

compiler-rt/lib/lsan/lsan_common_fuchsia.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier) {}
5151
// behavior and causes rare race conditions.
5252
void HandleLeaks() {}
5353

54-
// This is defined differently in asan_fuchsiap.cpp and lsan_fuchsia.cpp.
54+
// This is defined differently in asan_fuchsia.cpp and lsan_fuchsia.cpp.
5555
bool UseExitcodeOnLeak();
5656

5757
int ExitHook(int status) {

0 commit comments

Comments
 (0)