Skip to content

Fix the 'hosttools' bootstrapping build mode #42279

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
Apr 11, 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 SwiftCompilerSources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function(add_swift_compiler_modules_library name)

set(swift_compile_options
"-Xfrontend" "-validate-tbd-against-ir=none"
"-Xfrontend" "-enable-experimental-cxx-interop"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do this conditionally based on the version of the compiler?

Copy link
Contributor Author

@eeckstein eeckstein Apr 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we want to conditionally select between two options which do the same thing?

Aha yes, that's possible. Feel free to change it.
The only important thing is to not break the hosttools build mode.

"-Xfrontend" "-enable-cxx-interop"
"-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable")

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
5 changes: 5 additions & 0 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,11 @@ def enable_experimental_cxx_interop :
HelpText<"Enable C++ interop code generation and config directives">,
Flags<[FrontendOption, HelpHidden]>;

def enable_cxx_interop :
Flag<["-"], "enable-cxx-interop">,
HelpText<"Alias for -enable-experimental-cxx-interop">,
Flags<[FrontendOption, HelpHidden]>;
Comment on lines +831 to +834
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is really important that we have the word "experimental" in this flag. This is an expirmental feature, we need to make sure that's communicated to people using it.

Slightly related: I also want to add a warning anytime someone enables this.


def use_malloc : Flag<["-"], "use-malloc">,
HelpText<"Allocate internal data structures using malloc "
"(for memory debugging)">;
Expand Down
3 changes: 2 additions & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.ClangTarget = llvm::Triple(A->getValue());
}

Opts.EnableCXXInterop |= Args.hasArg(OPT_enable_experimental_cxx_interop);
Opts.EnableCXXInterop |= Args.hasArg(OPT_enable_experimental_cxx_interop) |
Args.hasArg(OPT_enable_cxx_interop);
Opts.EnableObjCInterop =
Args.hasFlag(OPT_enable_objc_interop, OPT_disable_objc_interop,
Target.isOSDarwin());
Expand Down