File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,9 @@ code for the target that is not the build machine:
350
350
* `` %target-cc-options `` : the clang flags to setup the target with the right
351
351
architecture and platform version.
352
352
353
+ * `` %target-sanitizer-opt `` : if sanitizers are enabled for the build, the
354
+ corresponding `` -fsanitize= `` option.
355
+
353
356
* `` %target-triple `` : a triple composed of the `` %target-cpu `` , the vendor,
354
357
the `` %target-os `` , and the operating system version number. Possible values
355
358
include `` i386-apple-ios7.0 `` or `` armv7k-apple-watchos2.0 `` .
Original file line number Diff line number Diff line change 2
2
3
3
// RUN: %empty-directory(%t)
4
4
// RUN: %target-build-swift %S/Inputs/interop.swift -emit-library -module-name InteropTest -o %t/%target-library-name(InteropTest)
5
- // RUN: %target-clang %S/Inputs/interop.m -framework Foundation -I %S/../../include/swift/SwiftRemoteMirror -I %S/../../include/ -o %t/InteropTest
5
+ // RUN: %target-clang %target-sanitizer-opt % S/Inputs/interop.m -framework Foundation -I %S/../../include/swift/SwiftRemoteMirror -I %S/../../include/ -o %t/InteropTest
6
6
// RUN: %target-codesign %t/%target-library-name(InteropTest)
7
7
// RUN: %target-codesign %t/InteropTest
8
8
// RUN: %target-run %t/InteropTest %t/%target-library-name(InteropTest) %platform-module-dir/%target-library-name(swiftRemoteMirror) | %FileCheck %s
Original file line number Diff line number Diff line change @@ -688,6 +688,11 @@ if config.benchmark_o != 'Benchmark_O':
688
688
# Add substitutions for the run target triple, CPU, OS, and pointer size.
689
689
config .substitutions .append (('%target-triple' , config .variant_triple ))
690
690
691
+ # Keep track of which sanitizers need to be enabled (matters for some tests)
692
+ config .sanitizers = []
693
+ if 'asan' in config .available_features :
694
+ config .sanitizers .append ('address' )
695
+
691
696
if run_vendor == 'apple' :
692
697
if run_os == 'maccatalyst' :
693
698
config .stable_abi_triple = '%s-%s-ios13.0-macabi' % (run_cpu , run_vendor )
@@ -2052,6 +2057,13 @@ if hasattr(config, 'target_cc_options'):
2052
2057
else :
2053
2058
config .substitutions .append (('%target-cc-options' , '' ))
2054
2059
2060
+ # Build an -fsanitize= argument (used by some tests)
2061
+ if config .sanitizers :
2062
+ config .substitutions .append (('%target-sanitizer-opt' ,
2063
+ '-fsanitize=' + ',' .join (config .sanitizers )))
2064
+ else :
2065
+ config .substitutions .append (('%target-sanitizer-opt' , '' ))
2066
+
2055
2067
# WORKAROUND(rdar://53507844): On some macOS versions, we see flaky failures in
2056
2068
# tests which create a hard link to an executable and immediately invoke it.
2057
2069
# Work around this by always copying on Darwin.
You can’t perform that action at this time.
0 commit comments