Skip to content

Commit

Permalink
[tsan] Allow TSan in the Clang driver for Apple Silicon Macs
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D84082
  • Loading branch information
kubamracek committed Jul 25, 2020
1 parent 739cd26 commit 33d9c41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/Driver/ToolChains/Darwin.cpp
Expand Up @@ -2714,6 +2714,7 @@ void Darwin::CheckObjCARC() const {

SanitizerMask Darwin::getSupportedSanitizers() const {
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
SanitizerMask Res = ToolChain::getSupportedSanitizers();
Res |= SanitizerKind::Address;
Res |= SanitizerKind::PointerCompare;
Expand All @@ -2731,9 +2732,8 @@ SanitizerMask Darwin::getSupportedSanitizers() const {
&& !(isTargetIPhoneOS() && isIPhoneOSVersionLT(5, 0)))
Res |= SanitizerKind::Vptr;

if (isTargetMacOS()) {
if (IsX86_64)
Res |= SanitizerKind::Thread;
if ((IsX86_64 || IsAArch64) && isTargetMacOS()) {
Res |= SanitizerKind::Thread;
} else if (isTargetIOSSimulator() || isTargetTvOSSimulator()) {
if (IsX86_64)
Res |= SanitizerKind::Thread;
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Driver/fsanitize.c
Expand Up @@ -458,6 +458,10 @@

// RUN: %clang -target x86_64-apple-darwin -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-DARWIN
// CHECK-TSAN-X86-64-DARWIN-NOT: unsupported option
// RUN: %clang -target x86_64-apple-macos -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-MACOS
// CHECK-TSAN-X86-64-MACOS-NOT: unsupported option
// RUN: %clang -target arm64-apple-macos -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-ARM64-MACOS
// CHECK-TSAN-ARM64-MACOS-NOT: unsupported option

// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-IOSSIMULATOR
// CHECK-TSAN-X86-64-IOSSIMULATOR-NOT: unsupported option
Expand Down

0 comments on commit 33d9c41

Please sign in to comment.