Skip to content

[interop][SwiftToCxx] ensure swift::Int and swift::UInt are usable in… #67290

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
Jul 14, 2023

Conversation

hyp
Copy link
Contributor

@hyp hyp commented Jul 13, 2023

… generic context

Fixes #63452

(cherry picked from commit 85a431e)

  • Explanation: The generated header contains a set of C++ type traits that allow some fundamental builtin types like int and int64_t to be used in Swift's generics from C++. However, the swift::Int and swift::UInt type is not guaranteed to be covered by existing set of templates on all platforms. More specifically, on Darwin, swift::Int -> ptrdiff_t -> long does not have a corresponding type trait, as long is not used for int64_t. In this case, we should add an explicit type trait for swift::Int and swift::UInt, to ensure that these types can be used in a generic context from C++ on Darwin.
  • Scope: C++ interop, generated header generator, generated C++ type traits for Swift's builtin types.
  • Risk: Low, adds new type traits only with minimal risk of template conflict.
  • Testing: Unit tests.
  • Original PR: [interop][SwiftToCxx] ensure swift::Int and swift::UInt are usable in… #67241

@hyp hyp added c++ interop Feature: Interoperability with C++ swift 5.9 labels Jul 13, 2023
@hyp hyp requested a review from a team as a code owner July 13, 2023 19:59
@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

@swift-ci please test

@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

@swift-ci please test source compatibility

@hyp hyp force-pushed the eng/5.9/reverse-interop-swiftInt branch from 8023810 to 435d0a6 Compare July 13, 2023 20:02
@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

added missing test

@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

@swift-ci please test

@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

@swift-ci please test source compatibility

@hyp
Copy link
Contributor Author

hyp commented Jul 13, 2023

@swift-ci please test macOS platform

@hyp hyp merged commit eae5b3c into swiftlang:release/5.9 Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++ swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants