Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit f9d194e

Browse files
committed
Disable using -fsanitize=leak from the Clang Driver.
LeakSanitizer (LSan) is not yet mature for Darwin so until this changes we should avoid supporting it in Swift Clang and AppleClang. rdar://problem/45841334
1 parent bd1f749 commit f9d194e

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

lib/Driver/ToolChains/Darwin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,9 @@ SanitizerMask Darwin::getSupportedSanitizers() const {
23582358
Res |= SanitizerKind::FuzzerNoLink;
23592359
Res |= SanitizerKind::Function;
23602360

2361+
// Apple-Clang: Don't support LSan. rdar://problem/45841334
2362+
Res &= ~SanitizerKind::Leak;
2363+
23612364
// Prior to 10.9, macOS shipped a version of the C++ standard library without
23622365
// C++11 support. The same is true of iOS prior to version 5. These OS'es are
23632366
// incompatible with -fsanitize=vptr.

test/Driver/apple-clang-no-lsan.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Apple-internal: Don't support LSan
2+
// REQUIRES: system-darwin
3+
// RUN: not %clang -fsanitize=leak %s -o %t 2>&1 | FileCheck %s
4+
// CHECK: unsupported option '-fsanitize=leak'
5+
int main() {
6+
return 0;
7+
}

test/Driver/fsanitize.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,25 +551,25 @@
551551
// CHECK-ESAN-OPENBSD: error: unsupported option '-fsanitize=efficiency-{{.*}}' for target 'i386-pc-openbsd'
552552

553553
// RUN: %clang -target x86_64-apple-darwin -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-DARWIN
554-
// CHECK-LSAN-X86-64-DARWIN-NOT: unsupported option
554+
// CHECK-LSAN-X86-64-DARWIN: unsupported option
555555

556556
// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-IOSSIMULATOR
557-
// CHECK-LSAN-X86-64-IOSSIMULATOR-NOT: unsupported option
557+
// CHECK-LSAN-X86-64-IOSSIMULATOR: unsupported option
558558

559559
// RUN: %clang -target x86_64-apple-tvossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-TVOSSIMULATOR
560-
// CHECK-LSAN-X86-64-TVOSSIMULATOR-NOT: unsupported option
560+
// CHECK-LSAN-X86-64-TVOSSIMULATOR: unsupported option
561561

562562
// RUN: %clang -target i386-apple-darwin -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-DARWIN
563-
// CHECK-LSAN-I386-DARWIN-NOT: unsupported option
563+
// CHECK-LSAN-I386-DARWIN: unsupported option
564564

565565
// RUN: %clang -target arm-apple-ios -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-ARM-IOS
566-
// CHECK-LSAN-ARM-IOS-NOT: unsupported option
566+
// CHECK-LSAN-ARM-IOS: unsupported option
567567

568568
// RUN: %clang -target i386-apple-iossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-IOSSIMULATOR
569-
// CHECK-LSAN-I386-IOSSIMULATOR-NOT: unsupported option
569+
// CHECK-LSAN-I386-IOSSIMULATOR: unsupported option
570570

571571
// RUN: %clang -target i386-apple-tvossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-TVOSSIMULATOR
572-
// CHECK-LSAN-I386-TVOSSIMULATOR-NOT: unsupported option
572+
// CHECK-LSAN-I386-TVOSSIMULATOR: unsupported option
573573

574574
// RUN: %clang -target i686-linux-gnu -fsanitize=efficiency-cache-frag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ESAN-X86
575575
// RUN: %clang -target i686-linux-gnu -fsanitize=efficiency-working-set %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ESAN-X86

test/Driver/sanitizer-ld.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,13 @@
537537
// CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
538538
// CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
539539

540+
// Apple-internal: Don't support LSan
540541
// RUN: %clangxx -fsanitize=leak %s -### -o %t.o 2>&1 \
541542
// RUN: -mmacosx-version-min=10.6 \
542543
// RUN: -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
543544
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
544545
// RUN: | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
545-
// CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
546-
// CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
547-
// CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
546+
// CHECK-LSAN-DARWIN106-CXX: unsupported option '-fsanitize=leak'
548547

549548
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
550549
// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \

0 commit comments

Comments
 (0)