Skip to content

Commit 79b7d5f

Browse files
committed
[Frontend] Disable skipping any function bodies for SwiftOnoneSupport
1 parent c2b3be4 commit 79b7d5f

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ ERROR(error_mode_cannot_emit_interface,none,
128128
ERROR(error_mode_cannot_emit_module_summary,none,
129129
"this mode does not support emitting module summary files", ())
130130
ERROR(cannot_emit_ir_skipping_function_bodies,none,
131-
"-experimental-skip-*-function-bodies do not support emitting IR", ())
131+
"the -experimental-skip-*-function-bodies* flags do not support "
132+
"emitting IR", ())
132133

133134
WARNING(emit_reference_dependencies_without_primary_file,none,
134135
"ignoring -emit-reference-dependencies (requires -primary-file)", ())
@@ -415,9 +416,9 @@ ERROR(expectation_missing_opening_braces,none,
415416
ERROR(expectation_missing_closing_braces,none,
416417
"didn't find '}}' to match '{{' in expectation", ())
417418

418-
WARNING(module_incompatible_with_skip_non_inlinable_function_bodies,none,
419-
"module '%0' cannot be built with "
420-
"-experimental-skip-non-inlinable-function-bodies; this option has "
419+
WARNING(module_incompatible_with_skip_function_bodies,none,
420+
"module '%0' cannot be built with any of the "
421+
"-experimental-skip-*-function-bodies* flags; they have "
421422
"been automatically disabled", (StringRef))
422423

423424
#define UNDEFINE_DIAGNOSTIC_MACROS

lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -744,15 +744,15 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
744744
if (Args.hasArg(OPT_experimental_skip_all_function_bodies))
745745
Opts.SkipFunctionBodies = FunctionBodySkipping::All;
746746

747-
if (Opts.SkipFunctionBodies == FunctionBodySkipping::NonInlinable &&
747+
if (Opts.SkipFunctionBodies != FunctionBodySkipping::None &&
748748
FrontendOpts.ModuleName == SWIFT_ONONE_SUPPORT) {
749-
// Disable this optimization if we're compiling SwiftOnoneSupport, because
750-
// we _definitely_ need to look inside every declaration to figure out
751-
// what gets prespecialized.
749+
// Disable these optimizations if we're compiling SwiftOnoneSupport,
750+
// because we _definitely_ need to look inside every declaration to figure
751+
// out what gets prespecialized.
752752
Opts.SkipFunctionBodies = FunctionBodySkipping::None;
753753
Diags.diagnose(
754754
SourceLoc(),
755-
diag::module_incompatible_with_skip_non_inlinable_function_bodies,
755+
diag::module_incompatible_with_skip_function_bodies,
756756
SWIFT_ONONE_SUPPORT);
757757
}
758758

test/Frontend/skip-function-bodies.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
// RUN: not %target-swift-frontend -c %s -experimental-skip-non-inlinable-function-bodies-without-types %s 2>&1 | %FileCheck %s --check-prefix ERROR
88
// RUN: not %target-swift-frontend -emit-ir %s -experimental-skip-all-function-bodies %s 2>&1 | %FileCheck %s --check-prefix ERROR
99
// RUN: not %target-swift-frontend -c %s -experimental-skip-all-function-bodies %s 2>&1 | %FileCheck %s --check-prefix ERROR
10-
// ERROR: -experimental-skip-*-function-bodies do not support emitting IR
10+
// ERROR: the -experimental-skip-*-function-bodies* flags do not support emitting IR
1111

12-
// Warn when trying to build SwiftONoneSupport with skip non-inlinable
13-
// function bodies enabled
12+
// Warn when trying to build SwiftONoneSupport with any skip enabled
1413
// RUN: %target-swift-frontend -typecheck -experimental-skip-non-inlinable-function-bodies -module-name SwiftOnoneSupport %s 2>&1 | %FileCheck %s --check-prefix WARNING
15-
// WARNING: module 'SwiftOnoneSupport' cannot be built with -experimental-skip-non-inlinable-function-bodies; this option has been automatically disabled
14+
// RUN: %target-swift-frontend -typecheck -experimental-skip-non-inlinable-function-bodies-without-types -module-name SwiftOnoneSupport %s 2>&1 | %FileCheck %s --check-prefix WARNING
15+
// RUN: %target-swift-frontend -typecheck -experimental-skip-all-function-bodies -module-name SwiftOnoneSupport %s 2>&1 | %FileCheck %s --check-prefix WARNING
16+
// WARNING: module 'SwiftOnoneSupport' cannot be built with any of the -experimental-skip-*-function-bodies* flags; they have been automatically disabled
1617

1718
// Check skipped bodies are neither typechecked nor SILgen'd
1819
// RUN: %target-swift-frontend -emit-sil -emit-sorted-sil -experimental-skip-non-inlinable-function-bodies -debug-forbid-typecheck-prefix NEVERTYPECHECK -debug-forbid-typecheck-prefix INLINENOTYPECHECK %s -o %t/Skip.noninlinable.sil

0 commit comments

Comments
 (0)