Skip to content

[ClangImporter] Add a mode to create the underlying Clang 'CompilerInvocation' directly from 'cc1' arguments, bypassing the Clang driver, only in the 'emit-pcm' compilation flow. #61303

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
Sep 27, 2022

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Sep 26, 2022

Controlled with a new flag -direct-clang-cc1-module-build

This will allow clients to formulate 'swift-frontend' invocations with fully-specified set of cc1 arguments (using -Xcc <FLAG>) required for the PCM build, without having to go through the driver.

When -direct-clang-cc1-module-build is specified, ClangImporter::createClangInvocation will now use Clang's clang::CompilerInvocation::CreateFromArgs directly with the provided CC1 flags, instead of going through the driver via Clang's clang::createInvocationFromCommandLine.

@artemcm
Copy link
Contributor Author

artemcm commented Sep 26, 2022

@swift-ci test

@artemcm
Copy link
Contributor Author

artemcm commented Sep 26, 2022

This will be used by the driver for Explicit Module Builds once #60882 lands on top of this change.

Copy link
Contributor

@jansvoboda11 jansvoboda11 left a comment

Choose a reason for hiding this comment

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

Nice! Left some comments in-line.

@artemcm artemcm force-pushed the DirectCC1ExplicitPCMBuild branch from 297e4f9 to 6db8317 Compare September 27, 2022 00:23
@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

@swift-ci test

@artemcm artemcm force-pushed the DirectCC1ExplicitPCMBuild branch from 6db8317 to 8d482cf Compare September 27, 2022 14:08
@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

@swift-ci smoke test

Copy link
Contributor

@jansvoboda11 jansvoboda11 left a comment

Choose a reason for hiding this comment

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

LGTM if tests pass. Thank you!

artemcm added a commit to artemcm/swift-driver that referenced this pull request Sep 27, 2022
As of swiftlang/swift#60882 and swiftlang/swift#61303, emit-pcm will accept clang frontend arguments with '-Xcc', instead of clang driver arguments.
artemcm added a commit to artemcm/swift-driver that referenced this pull request Sep 27, 2022
As of swiftlang/swift#60882 and swiftlang/swift#61303, emit-pcm will accept clang frontend arguments with '-Xcc', instead of clang driver arguments.
…vocation' directly from 'cc1' arguments, bypassing the Clang driver, only in the 'emit-pcm' compilation flow.

Controlled with a new flag '-direct-clang-cc1-module-build'

This will allow clients to formulate 'swift-frontend' invocations with fully-specified set of cc1 arguments (using '-Xcc -Xclang -Xcc <FLAG>') required for the PCM build, without having to go through the driver.
@artemcm artemcm force-pushed the DirectCC1ExplicitPCMBuild branch from 8d482cf to bfa6375 Compare September 27, 2022 16:59
@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

@swift-ci smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

Thanks @benlangmuir !

@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

@swift-ci smoke test Linux platform

@artemcm
Copy link
Contributor Author

artemcm commented Sep 27, 2022

@swift-ci smoke test macOS platform

@artemcm artemcm merged commit b74d766 into swiftlang:main Sep 27, 2022
@artemcm artemcm deleted the DirectCC1ExplicitPCMBuild branch September 27, 2022 22:51
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.

3 participants