Skip to content

Generate swiftinterface files next to the stdlib swiftmodules #18973

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 3 commits into from
Aug 28, 2018

Conversation

jrose-apple
Copy link
Contributor

Add a driver option -experimental-emit-interface for textual interfaces, then hook it up in CMake. We're not using this for anything yet, but this will exercise -emit-interface while we're working on it and make sure that it doesn't crash when processing complex code like the standard library.

Looking for review from David or Graydon on the Driver changes and Ross or Michael for the CMake.

The OutputInfo, ToolChain, and Triple can all be retrieved from the
Compilation, so now that we're passing one of those around we don't
need to pass the others explicitly.

No functionality change.
This will eventually become plain old -emit-interface, but we don't
want people to be using it just yet. This is just for testing.
We're not using them for anything yet, but this will exercise
-emit-interface while we're working on it and make sure that it
doesn't crash when processing complex code like the standard library.
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

One question, one comment, nothing major: I'm really excited you're doing this! Onwards!

} else if (Args.hasArg(options::OPT_emit_objc_header,
options::OPT_emit_objc_header_path,
options::OPT_experimental_emit_interface) &&
OI.CompilerMode != OutputInfo::Mode::SingleCompile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the additional OI.CompilerMode != OutputInfo::Mode::SingleCompile condition here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are outputs that need whole-module knowledge in some form, but don't actually need a swiftmodule to be generated. So if you're compiling with WMO and don't need a swiftmodule for whatever reason, you won't spend time generating one anymore. I don't really expect this to come up in practice, though.

case OutputInfo::Mode::StandardCompile:
case OutputInfo::Mode::BatchModeCompile:
if (!isa<MergeModuleJobAction>(JA))
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not super keen on this pattern of silently not-doing what the function's name says it does, when not matching certain conditions not-expressed in the signature; it means that reading the caller, one's assumption that "a textual interface output name has been set" is not correct. But I know it matches other filename-choosing functions. Do you feel like there's an easy way to tidy it up a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, all of these split their conditions between the callers and the first few lines of the function, which is a little funny. Maybe they should all be addFooBarIfNeeded like the frontend helper functions instead.

I was justifying continuing this pattern by saying "nil is a valid 'choice'", but if you want I can put more thought into that.

Copy link
Contributor

@Rostepher Rostepher left a comment

Choose a reason for hiding this comment

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

The CMake changes look reasonable to me.

@jrose-apple jrose-apple merged commit 6ffe644 into swiftlang:master Aug 28, 2018
@jrose-apple jrose-apple deleted the interfacepalm branch August 28, 2018 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants