Skip to content

Frontend: flip the default of whether importing SPI_AVAILABLE from clang #42114

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
Mar 31, 2022
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
2 changes: 1 addition & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ namespace swift {
bool DisableOverlayModules = false;

/// When set, import SPI_AVAILABLE symbols with Swift SPI attribtues.
bool EnableClangSPI = false;
bool EnableClangSPI = true;

/// When set, don't enforce warnings with -Werror.
bool DebuggerSupport = false;
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def disable_testable_attr_requires_testable_module :
Flag<["-"], "disable-testable-attr-requires-testable-module">,
HelpText<"Disable checking of @testable">;

def enable_clang_spi :
Flag<["-"], "enable-clang-spi">,
HelpText<"Import Clang SPIs as Swift SPIs">;
def disable_clang_spi :
Flag<["-"], "disable-clang-spi">,
HelpText<"Don't import Clang SPIs as Swift SPIs">;

def enable_target_os_checking :
Flag<["-"], "enable-target-os-checking">,
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9069,7 +9069,7 @@ void ClangImporter::Implementation::importAttributes(
obsoleted,
/*ObsoletedRange=*/SourceRange(),
PlatformAgnostic, /*Implicit=*/false,
IsSPI);
EnableClangSPI && IsSPI);

MappedDecl->getAttrs().add(AvAttr);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,

Opts.DisableOverlayModules |= Args.hasArg(OPT_emit_imported_modules);

Opts.EnableClangSPI |= Args.hasArg(OPT_enable_clang_spi);
Opts.EnableClangSPI = !Args.hasArg(OPT_disable_clang_spi);

Opts.ExtraArgsOnly |= Args.hasArg(OPT_extra_clang_options_only);

Expand Down