forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request swiftlang#2076 from apple/asan
Add experimental support for Thread Sanitizer
- Loading branch information
Showing
12 changed files
with
116 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,54 @@ | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=ASAN -check-prefix=OSX %s | ||
|
||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-ios7.1 %s | FileCheck -check-prefix=ASAN -check-prefix=IOSSIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-ios7.1 %s | FileCheck -check-prefix=ASAN -check-prefix=IOS %s | ||
|
||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-tvos9.0 %s | FileCheck -check-prefix=ASAN -check-prefix=tvOS_SIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-tvos9.0 %s | FileCheck -check-prefix=ASAN -check-prefix=tvOS %s | ||
|
||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target i386-apple-watchos2.0 %s | FileCheck -check-prefix=ASAN -check-prefix=watchOS_SIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target armv7k-apple-watchos2.0 %s | FileCheck -check-prefix=ASAN -check-prefix=watchOS %s | ||
|
||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=LINUX %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_OSX %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-ios7.1 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOSSIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-ios7.1 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_IOS %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-apple-tvos9.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS_SIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target arm64-apple-tvos9.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_tvOS %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target i386-apple-watchos2.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS_SIM %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=address -target armv7k-apple-watchos2.0 %s | FileCheck -check-prefix=ASAN -check-prefix=ASAN_watchOS %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -target x86_64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=ASAN_LINUX %s | ||
|
||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-macosx10.9 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_OSX %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86-apple-macosx10.9 %s 2>&1 | FileCheck -check-prefix=TSAN_OSX_32 %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-ios7.1 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_IOSSIM %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-ios7.1 %s 2>&1 | FileCheck -check-prefix=TSAN_IOS %s | ||
// RUN: %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-apple-tvos9.0 %s | FileCheck -check-prefix=TSAN -check-prefix=TSAN_tvOS_SIM %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target arm64-apple-tvos9.0 %s 2>&1 | FileCheck -check-prefix=TSAN_tvOS %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target i386-apple-watchos2.0 %s 2>&1 | FileCheck -check-prefix=TSAN_watchOS_SIM %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target armv7k-apple-watchos2.0 %s 2>&1 | FileCheck -check-prefix=TSAN_watchOS %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=thread -target x86_64-unknown-linux-gnu %s 2>&1 | FileCheck -check-prefix=TSAN_LINUX %s | ||
|
||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,unknown %s 2>&1 | FileCheck -check-prefix=BADARG %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address -sanitize=unknown %s 2>&1 | FileCheck -check-prefix=BADARG %s | ||
// RUN: not %swiftc_driver -driver-print-jobs -sanitize=address,thread %s 2>&1 | FileCheck -check-prefix=INCOMPATIBLESANITIZERS %s | ||
|
||
// ASAN: swift | ||
// ASAN: -sanitize=address | ||
|
||
// OSX: lib/swift/clang/lib/darwin/libclang_rt.asan_osx_dynamic.dylib | ||
// IOS: lib/swift/clang/lib/darwin/libclang_rt.asan_ios_dynamic.dylib | ||
// IOSSIM: lib/swift/clang/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib | ||
// tvOS: lib/swift/clang/lib/darwin/libclang_rt.asan_tvos_dynamic.dylib | ||
// tvOS_SIM: lib/swift/clang/lib/darwin/libclang_rt.asan_tvossim_dynamic.dylib | ||
// watchOS: lib/swift/clang/lib/darwin/libclang_rt.asan_watchos_dynamic.dylib | ||
// watchOS_SIM: lib/swift/clang/lib/darwin/libclang_rt.asan_watchossim_dynamic.dylib | ||
// LINUX: unsupported option 'sanitize=address' for target 'x86_64-unknown-linux-gnu' | ||
// ASAN_OSX: lib/swift/clang/lib/darwin/libclang_rt.asan_osx_dynamic.dylib | ||
// ASAN_IOSSIM: lib/swift/clang/lib/darwin/libclang_rt.asan_iossim_dynamic.dylib | ||
// ASAN_IOS: lib/swift/clang/lib/darwin/libclang_rt.asan_ios_dynamic.dylib | ||
// ASAN_tvOS_SIM: lib/swift/clang/lib/darwin/libclang_rt.asan_tvossim_dynamic.dylib | ||
// ASAN_tvOS: lib/swift/clang/lib/darwin/libclang_rt.asan_tvos_dynamic.dylib | ||
// ASAN_watchOS_SIM: lib/swift/clang/lib/darwin/libclang_rt.asan_watchossim_dynamic.dylib | ||
// ASAN_watchOS: lib/swift/clang/lib/darwin/libclang_rt.asan_watchos_dynamic.dylib | ||
// ASAN_LINUX: unsupported option '-sanitize=address' for target 'x86_64-unknown-linux-gnu' | ||
|
||
// ASAN: -rpath @executable_path | ||
|
||
// BADARG: unsupported argument 'unknown' to option 'sanitize=' | ||
// TSAN: swift | ||
// TSAN: -sanitize=thread | ||
|
||
// TSAN_OSX: lib/swift/clang/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | ||
// TSAN_OSX_32: unsupported option '-sanitize=thread' for target 'x86-apple-macosx10.9' | ||
// TSAN_IOSSIM: lib/swift/clang/lib/darwin/libclang_rt.tsan_iossim_dynamic.dylib | ||
// TSAN_IOS: unsupported option '-sanitize=thread' for target 'arm64-apple-ios7.1' | ||
// TSAN_tvOS_SIM: lib/swift/clang/lib/darwin/libclang_rt.tsan_tvossim_dynamic.dylib | ||
// TSAN_tvOS: unsupported option '-sanitize=thread' for target 'arm64-apple-tvos9.0' | ||
// TSAN_watchOS_SIM: unsupported option '-sanitize=thread' for target 'i386-apple-watchos2.0' | ||
// TSAN_watchOS: unsupported option '-sanitize=thread' for target 'armv7k-apple-watchos2.0' | ||
// TSAN_LINUX: unsupported option '-sanitize=thread' for target 'x86_64-unknown-linux-gnu' | ||
|
||
// TSAN: -rpath @executable_path | ||
|
||
// BADARG: unsupported argument 'unknown' to option '-sanitize=' | ||
// INCOMPATIBLESANITIZERS: argument '-sanitize=address' is not allowed with '-sanitize=thread' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
// This test verifies that we add the function attributes used by sanitizers. | ||
|
||
// RUN: %target-swift-frontend -emit-ir -sanitize=address %s | FileCheck %s -check-prefix=ASAN | ||
// RUN: %target-swift-frontend -emit-ir -target x86_64-apple-macosx10.9 -sanitize=thread %s | FileCheck %s -check-prefix=TSAN | ||
|
||
// XFAIL: linux | ||
|
||
func test() { | ||
} | ||
|
||
// ASAN: Function Attrs: sanitize_address | ||
// TSAN: Function Attrs: sanitize_thread |