Skip to content

Commit c9b2d8b

Browse files
committed
Diagnose the use of -disable-access-checking with strict safety checking
1 parent 6855dc4 commit c9b2d8b

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,9 @@ ERROR(experimental_not_supported_in_production,none,
589589
"experimental feature '%0' cannot be enabled in production compiler",
590590
(StringRef))
591591

592-
GROUPED_WARNING(Ounchecked_with_strict_safety,Unsafe,none,
593-
"'-Ounchecked' is not memory-safe and should not be combined with "
594-
"strict memory safety checking", ())
592+
GROUPED_WARNING(command_line_conflicts_with_strict_safety,Unsafe,none,
593+
"'%0' is not memory-safe and should not be combined with "
594+
"strict memory safety checking", (StringRef))
595595

596596
#define UNDEFINE_DIAGNOSTIC_MACROS
597597
#include "DefineDiagnosticMacros.h"

lib/Frontend/CompilerInvocation.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3840,7 +3840,15 @@ bool CompilerInvocation::parseArgs(
38403840
if (LangOpts.hasFeature(Feature::WarnUnsafe)) {
38413841
if (SILOpts.RemoveRuntimeAsserts ||
38423842
SILOpts.AssertConfig == SILOptions::Unchecked) {
3843-
Diags.diagnose(SourceLoc(), diag::Ounchecked_with_strict_safety);
3843+
Diags.diagnose(SourceLoc(),
3844+
diag::command_line_conflicts_with_strict_safety,
3845+
"-Ounchecked");
3846+
}
3847+
3848+
if (!LangOpts.EnableAccessControl) {
3849+
Diags.diagnose(SourceLoc(),
3850+
diag::command_line_conflicts_with_strict_safety,
3851+
"-disable-access-control");
38443852
}
38453853
}
38463854

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// RUN: %target-swift-frontend -typecheck -enable-experimental-feature WarnUnsafe -Ounchecked %s 2>&1 | %FileCheck %s
1+
// RUN: %target-swift-frontend -typecheck -enable-experimental-feature WarnUnsafe -Ounchecked -disable-access-control %s 2>&1 | %FileCheck %s
22

33
// REQUIRES: swift_feature_WarnUnsafe
44

55
// CHECK: warning: '-Ounchecked' is not memory-safe
6+
// CHECK: warning: '-disable-access-control' is not memory-safe

0 commit comments

Comments
 (0)