Skip to content

[Driver] Move the flag -check-api-availability-only to the driver #39928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,6 @@ def disable_availability_checking : Flag<["-"],
"disable-availability-checking">,
HelpText<"Disable checking for potentially unavailable APIs">;

def check_api_availability_only : Flag<["-"],
"check-api-availability-only">,
HelpText<"Only check the availability of the APIs, ignore function bodies">;

def enable_conformance_availability_errors : Flag<["-"],
"enable-conformance-availability-errors">,
HelpText<"Diagnose conformance availability violations as errors">;
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ def define_availability : Separate<["-"], "define-availability">,
HelpText<"Define an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'">,
MetaVarName<"<macro>">;

def check_api_availability_only : Flag<["-"], "check-api-availability-only">,
Flags<[HelpHidden, FrontendOption, NoInteractiveOption]>,
HelpText<"Only check the availability of the APIs, ignore function bodies">;

def library_level : Separate<["-"], "library-level">,
MetaVarName<"<level>">,
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
Expand Down
1 change: 1 addition & 0 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
inputArgs.AddLastArg(arguments, options::OPT_require_explicit_availability);
inputArgs.AddLastArg(arguments, options::OPT_require_explicit_availability_target);
inputArgs.AddLastArg(arguments, options::OPT_require_explicit_sendable);
inputArgs.AddLastArg(arguments, options::OPT_check_api_availability_only);
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
inputArgs.AddLastArg(arguments, options::OPT_enable_private_imports);
inputArgs.AddLastArg(arguments, options::OPT_g_Group);
Expand Down
2 changes: 1 addition & 1 deletion test/Sema/api-availability-only-ok.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// RUN: %empty-directory(%t)

// RUN: %swiftc_driver -emit-module %s -target %target-cpu-apple-macosx10.15 -emit-module-interface -emit-module-interface-path %t/main.swiftinterface -enable-library-evolution -Xfrontend -check-api-availability-only -verify-emitted-module-interface
// RUN: %swiftc_driver -emit-module %s -target %target-cpu-apple-macosx10.15 -emit-module-interface -emit-module-interface-path %t/main.swiftinterface -enable-library-evolution -check-api-availability-only -verify-emitted-module-interface
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/main.swiftinterface

// REQUIRES: OS=macosx
Expand Down
1 change: 1 addition & 0 deletions test/Sema/api-availability-only.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// RUN: %target-typecheck-verify-swift -module-name MyModule -target %target-cpu-apple-macosx10.15 -check-api-availability-only -enable-library-evolution

/// The flag -check-api-availability-only should reject builds going up to IR and further.
// RUN: not %target-build-swift -emit-executable %s -g -o %t -emit-module -Xfrontend -check-api-availability-only 2>&1 | %FileCheck %s
// CHECK: the flag -check-api-availability-only does not support emitting IR

Expand Down