-
Notifications
You must be signed in to change notification settings - Fork 10.5k
ClangImporter: synchronize clang and Swift #35290
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
Conversation
CC: @zoecarver @hlopko @pschuh |
@swift-ci please test Windows platform |
@swift-ci please test |
Build failed |
test/Interop/Cxx/templates/class-template-non-type-parameter.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable. Thanks!
Build failed |
@swift-ci please test Windows platform |
This synchronizes the C/C++ standard that Swift uses for the clang importer with the defaults of the clang compiler. The default for the C standard remains the same at `gnu11`. However, if clang was built with a different default C standard, that will be preferred. The default for the C++ standard is moved to C++14. Although this is a reduced version, it matches what the current clang compiler defaults to. Additionally, if the user built clang with a different C++ standard, that standard would be preferred. Although the C++ support is a bit more conservative, the idea is that we can be certain that the clang version fully supports this standard as it it the default version for clang. The test change made here replaces the use of `auto` type parameters to templates which is a C++17 feature. Reduce the example to a C++14 equivalent. The clang version seems to behave differently in preventing the synthesis of the constexpr value. This persists into the newer clang releases as well. This is reasonable as the value does not need to be exported necessarily and users will be able to materialize the value. We use the optimizer to ensure that the value is inlined. This also repairs the C++ interop tests on Windows with a newer C++ runtime from Microsoft.
@swift-ci please test |
SR-14023 tracks the issue identified here with the materialization of the |
Build failed |
@swift-ci please test macOS platform |
Build failed |
@swift-ci please test macOS platform |
This synchronizes the C/C++ standard that Swift uses for the clang
importer with the defaults of the clang compiler.
The default for the C standard remains the same at
gnu11
. However, ifclang was built with a different default C standard, that will be
preferred.
The default for the C++ standard is moved to C++14. Although this is a
reduced version, it matches what the current clang compiler defaults to.
Additionally, if the user built clang with a different C++ standard,
that standard would be preferred.
Although the C++ support is a bit more conservative, the idea is that we
can be certain that the clang version fully supports this standard as it
it the default version for clang.
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.