Skip to content

Commit 3687257

Browse files
authored
Merge pull request #8288 from devincoughlin/tsan_inout_enable_by_default
2 parents c424f51 + 70fbfea commit 3687257

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace swift {
164164

165165
/// \brief Staging flag for treating inout parameters as Thread Sanitizer
166166
/// accesses.
167-
bool EnableTSANInoutInstrumentation = false;
167+
bool DisableTsanInoutInstrumentation = false;
168168

169169
/// \brief Staging flag for class resilience, which we do not want to enable
170170
/// fully until more code is in place, to allow the standard library to be

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ def disable_availability_checking : Flag<["-"],
267267
"disable-availability-checking">,
268268
HelpText<"Disable checking for potentially unavailable APIs">;
269269

270-
def enable_experimental_tsan_inout_instrumentation : Flag<["-"],
271-
"enable-experimental-tsan-inout-instrumentation">,
272-
HelpText<"Enable treatment of inout parameters as Thread Sanitizer accesses">;
270+
def disable_tsan_inout_instrumentation : Flag<["-"],
271+
"disable-tsan-inout-instrumentation">,
272+
HelpText<"Disable treatment of inout parameters as Thread Sanitizer accesses">;
273273

274274
def enable_infer_import_as_member :
275275
Flag<["-"], "enable-infer-import-as-member">,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
860860
Opts.DisableAvailabilityChecking |=
861861
Args.hasArg(OPT_disable_availability_checking);
862862

863-
Opts.EnableTSANInoutInstrumentation |=
864-
Args.hasArg(OPT_enable_experimental_tsan_inout_instrumentation);
863+
Opts.DisableTsanInoutInstrumentation |=
864+
Args.hasArg(OPT_disable_tsan_inout_instrumentation);
865865

866866
if (FrontendOpts.InputKind == InputFileKind::IFK_SIL)
867867
Opts.DisableAvailabilityChecking = true;

lib/SILGen/SILGenLValue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2428,7 +2428,8 @@ static ManagedValue drillIntoComponent(SILGenFunction &SGF,
24282428
addr = std::move(lcomponent).getMaterialized(SGF, loc, base, accessKind);
24292429
}
24302430

2431-
if (SGF.getASTContext().LangOpts.EnableTSANInoutInstrumentation &&
2431+
if (!SGF.getASTContext().LangOpts.DisableTsanInoutInstrumentation &&
2432+
SGF.getModule().getOptions().Sanitize == SanitizerKind::Thread &&
24322433
tsanKind == TSanKind::InoutAccess && !component.isRValue()) {
24332434
emitTsanInoutAccess(SGF, loc, addr);
24342435
}

test/SILGen/tsan_instrumentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -sanitize=thread -enable-experimental-tsan-inout-instrumentation -emit-silgen %s | %FileCheck %s
1+
// RUN: %target-swift-frontend -sanitize=thread -emit-silgen %s | %FileCheck %s
22
// REQUIRES: tsan_runtime
33
// XFAIL: linux
44

test/Sanitizers/tsan-inout.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-build-swift %S/Inputs/tsan-uninstrumented.swift -module-name TSanUninstrumented -emit-module -emit-module-path %T/TSanUninstrumented.swiftmodule -parse-as-library
22
// RUN: %target-build-swift %S/Inputs/tsan-uninstrumented.swift -c -module-name TSanUninstrumented -parse-as-library -o %T/TSanUninstrumented.o
3-
// RUN: %target-swiftc_driver -Xfrontend -enable-experimental-tsan-inout-instrumentation %s %T/TSanUninstrumented.o -I%T -L%T -g -sanitize=thread -o %t_tsan-binary
3+
// RUN: %target-swiftc_driver %s %T/TSanUninstrumented.o -I%T -L%T -g -sanitize=thread -o %t_tsan-binary
44
// RUN: not env TSAN_OPTIONS=abort_on_error=0 %target-run %t_tsan-binary 2>&1 | %FileCheck %s
55
// RUN: not env TSAN_OPTIONS=abort_on_error=0:ignore_interceptors_accesses=0 %target-run %t_tsan-binary 2>&1 | %FileCheck %s --check-prefix CHECK-INTERCEPTORS-ACCESSES
66
// REQUIRES: executable_test

0 commit comments

Comments
 (0)