Skip to content
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

[Interop][SwiftToCxx] Emit helper cases class in C++ for Swift enum #59669

Merged
merged 3 commits into from Jun 25, 2022

Conversation

WANGJIEKE
Copy link
Contributor

Emit Swift enum cases inside generated C++ class. For example, following Swift enum

public enum Foo { case x, y, z }

will have cases in generated C++ header file like this

class Foo final {
public:
  enum class cases { x, y, z };
};

@hyp Could you review this pull request?

@hyp hyp added the c++ interop Feature: Interoperability with C++ label Jun 23, 2022
@hyp
Copy link
Contributor

hyp commented Jun 23, 2022

@swift-ci please test

@hyp
Copy link
Contributor

hyp commented Jun 23, 2022

@swift-ci please test source compatibility

@hyp
Copy link
Contributor

hyp commented Jun 24, 2022

Looks good. The only thing I was wondering about if the cases should be printed out separately on new lines, instead if all being on the same line. Wdyt?

@WANGJIEKE
Copy link
Contributor Author

WANGJIEKE commented Jun 24, 2022

Yeah maybe it's better to print one line per case so that if there's an enum with lots of cases, it can be more human-readable. I think it's typically easier to scroll vertically than horizontally.

@hyp
Copy link
Contributor

hyp commented Jun 24, 2022

@swift-ci please test

@hyp
Copy link
Contributor

hyp commented Jun 24, 2022

@swift-ci please test source compatibility

@hyp hyp merged commit 0dae896 into apple:main Jun 25, 2022
@WANGJIEKE WANGJIEKE deleted the cxx-interop-enum-cases-class branch July 13, 2022 17:34
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++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants