Skip to content

Commit 9cb3702

Browse files
committed
[Driver] Make -library-level a driver argument and pass it to the frontend
rdar://82458987
1 parent b201d48 commit 9cb3702

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,6 @@ def disable_swift3_objc_inference :
485485
Flags<[FrontendOption, HelpHidden]>,
486486
HelpText<"Disable Swift 3's @objc inference rules for NSObject-derived classes and 'dynamic' members (emulates Swift 4 behavior)">;
487487

488-
def library_level : Separate<["-"], "library-level">,
489-
MetaVarName<"<level>">,
490-
Flags<[FrontendOption, ModuleInterfaceOption]>,
491-
HelpText<"Library distribution level 'api', 'spi' or 'other' (the default)">;
492-
493488
def enable_implicit_dynamic : Flag<["-"], "enable-implicit-dynamic">,
494489
Flags<[FrontendOption, NoInteractiveOption, HelpHidden]>,
495490
HelpText<"Add 'dynamic' to all declarations">;

include/swift/Option/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@ def define_availability : Separate<["-"], "define-availability">,
418418
HelpText<"Define an availability macro in the format 'macroName : iOS 13.0, macOS 10.15'">,
419419
MetaVarName<"<macro>">;
420420

421+
def library_level : Separate<["-"], "library-level">,
422+
MetaVarName<"<level>">,
423+
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
424+
HelpText<"Library distribution level 'api', 'spi' or 'other' (the default)">;
425+
421426
def module_name : Separate<["-"], "module-name">,
422427
Flags<[FrontendOption, ModuleInterfaceOption, SwiftAPIExtractOption,
423428
SwiftSymbolGraphExtractOption]>,

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
285285
inputArgs.AddLastArg(arguments,
286286
options::OPT_verify_incremental_dependencies);
287287
inputArgs.AddLastArg(arguments, options::OPT_access_notes_path);
288+
inputArgs.AddLastArg(arguments, options::OPT_library_level);
288289

289290
// Pass on any build config options
290291
inputArgs.AddAllArgs(arguments, options::OPT_D);

test/Sema/implementation-only-import-suggestion.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
2121
// RUN: -library-level spi -D PUBLIC_IMPORTS
2222

23+
/// The driver should also accept the flag and pass it along.
24+
// RUN: %swiftc_driver -typecheck -sdk %t/sdk -module-cache-path %t %s \
25+
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \
26+
// RUN: -library-level spi -D PUBLIC_IMPORTS
27+
2328
/// Expect no warnings when building a client with some other library level.
2429
// RUN: %target-swift-frontend -typecheck -sdk %t/sdk -module-cache-path %t %s \
2530
// RUN: -F %t/sdk/System/Library/PrivateFrameworks/ \

0 commit comments

Comments
 (0)