Skip to content
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

[ModuleInterface] Save -public-autolink-library module option #74277

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
7 changes: 4 additions & 3 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ def no_serialize_debugging_options :
def autolink_library : Separate<["-"], "autolink-library">,
HelpText<"Add dependent library">, Flags<[FrontendOption]>;

def public_autolink_library : Separate<["-"], "public-autolink-library">,
HelpText<"Add public dependent library">, Flags<[FrontendOption]>;

def disable_typo_correction : Flag<["-"], "disable-typo-correction">,
HelpText<"Disable typo correction">;

Expand Down Expand Up @@ -369,6 +366,10 @@ def enable_resilience : Flag<["-"], "enable-resilience">,
def enable_experimental_async_top_level :
Flag<["-"], "enable-experimental-async-top-level">,
HelpText<"Enable experimental concurrency in top-level code">;

def public_autolink_library :
Separate<["-"], "public-autolink-library">,
HelpText<"Add public dependent library">;
}

// HIDDEN FLAGS
Expand Down
2 changes: 2 additions & 0 deletions lib/Frontend/ModuleInterfaceBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName;
SerializationOpts.AutolinkForceLoad =
!Invocation.getIRGenOptions().ForceLoadSymbolName.empty();
SerializationOpts.PublicDependentLibraries =
Invocation.getIRGenOptions().PublicLinkLibraries;
SerializationOpts.UserModuleVersion = FEOpts.UserModuleVersion;
SerializationOpts.AllowableClients = FEOpts.AllowableClients;
StringRef SDKPath = Instance.getASTContext().SearchPathOpts.getSDKPath();
Expand Down
6 changes: 6 additions & 0 deletions test/ModuleInterface/public-autolink-library.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -module-name Foo -emit-module-interface-path %t/Foo.swiftinterface %s -module-link-name Foo -enable-library-evolution -public-autolink-library Bar
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Foo.swiftmodule %t/Foo.swiftinterface
// RUN: %target-swift-ide-test -print-module-metadata -module-to-print Foo -I %t -source-filename %s | %FileCheck %s

// CHECK: link library: Bar