-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop][IRGen] Walk initializer decls when walking constructor decls #41584
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
[cxx-interop][IRGen] Walk initializer decls when walking constructor decls #41584
Conversation
Nice work @bulbazord. |
For more context, see: #39551 |
I was under the impression that #35056 fixed this. This test fails on main? |
The test added in this PR fails on main (at least on my machine). I believe the key difference here is that that patch visits |
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.
Tested locally. Looks like this is actually an issue.
It's odd that the decl finder doesn't visit the inits already. Anyway, this looks great. Thank you for fixing it.
Hmm I suppose that makes sense. This was probably something the Google folks overlooked in their patch, as I suspect they meant to test this case. Thank you for explaining :) |
I'll trigger the bots once that test is fixed. Sorry if this is a big ask, but it looks like a lot of similar things are already tested in |
c21199e
to
855d9b1
Compare
@zoecarver I went ahead and merged what I had with the tests in |
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.
Beautiful. Thank you!
@swift-ci please test. |
855d9b1
to
a7e5caa
Compare
Modified the tests to fix the windows failure. Hopefully things are good now. Could you retrigger the tests @zoecarver? |
@swift-ci please test. |
@swift-ci please smoke test |
This addresses SR-15272. When you have a function (e.g. 'foo') which is used in a constructor initializer (e.g. constructor of some class 'Bar'), and you use the constructor from swift code without directly using the function (e.g. Bar's ctor is used from swift but foo isn't, foo is used from Bar's ctor), you will get a link error. My fix is as follows: When walking the clangAST to be imported, make sure you look at each CXXCtorInitializer for each CXXConstructorDecl you see.
a7e5caa
to
edbb448
Compare
I believe I've fixed the windows test (2 characters were swapped in the mangled name, whoops!). |
@swift-ci please smoke test |
@swift-ci please test Linux platform |
This addresses SR-15272.
When you have a function (e.g. 'foo') which is used in a constructor
initializer (e.g. constructor of some class 'Bar'), and you use the
constructor from swift code without directly using the function (e.g.
Bar's ctor is used from swift but foo isn't, foo is used from Bar's ctor),
you will get a link error. My fix is as follows:
When walking the clangAST to be imported, make sure you look at each
CXXCtorInitializer for each CXXConstructorDecl you see.