-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add importing cxx function decls and the basic requisite AbstractionPattern support. #26047
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
rjmccall
left a comment
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.
Just a bunch of minor comments.
16fc18f to
026ae3c
Compare
jrose-apple
left a comment
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 pretty straightforward, and I admit I can't comment too much on the AbstractionPattern parts. However, two things stuck out to me:
-
Where do we treat static C++ methods differently from non-static ones? Or should we treat static ones like C functions, and the AbstractionPattern for C++ methods is really "C++ instance methods"?
-
Is it possible for us to avoid adding all the new kinds of AbstractionPattern? A CXXMethodDecl is already a kind of clang::FunctionDecl, and we can already import regular functions as methods using
NS_SWIFT_NAME. On the Swift side, a C++ instance method just has a different set of calling conventions but otherwise seems the same.
I admit this second part is born out of people asking about other importers, even if that's way more in the hypothetical future. I'm not going to go as far as to say everything needs to fit into the existing mold, or that you have to generalize everything so that we can implement a Fortran importer, but if we can figure out what needs to be generalized as part of your work, or at least avoid special-casing a ton of things, that's good.
I left more comments on the ClangImporter part, small as it was, but I don't think any of them are too significant.
rjmccall
left a comment
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.
Minor tweak, but looking really good.
cbb3710 to
3037d59
Compare
|
I think I have no remaining comments; leaving it to @rjmccall for final approval. |
|
@swift-ci please test |
|
@swift-ci please test |
|
Build failed |
|
Build failed |
|
@rjmccall John, could you take a quick look at this? It should be straightforward to approve. |
|
I was just on vacation for three days; looking at it now. |
rjmccall
left a comment
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.
LGTM
Known issues so far:
vs non-const.
fact that self is indirect is getting lost in the lowering process (becomes
@in)This is just some ImportDecl.cpp changes and CXXMethodConventions + the boilerplate in AbstractionPattern. There will probably need to be more to fully support methods.