-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Re-implement template mangling. #62989
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] Re-implement template mangling. #62989
Conversation
There are still about 30 failing tests and I should also write some new tests, so I'm keeping this as a draft. |
lib/Parse/Parser.cpp
Outdated
if (!Lexer::isIdentifier(baseName) && !Lexer::isOperator(baseName)) | ||
return DeclNameRef(); | ||
// if (!Lexer::isIdentifier(baseName) && !Lexer::isOperator(baseName)) | ||
// return DeclNameRef(); |
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.
I will need to find a better condition here. I will probably just make this an assert and put it elsewhere.
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.
I haven't forgotten about this, just want to see how we're doing on tests.
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.
I actually don't know how helpful this behavior is. I am going to remove this from the patch and if the code owners feel that we need further validation of names then let's add this as an assert after the fact.
ca47396
to
611e6f5
Compare
@swift-ci please test |
611e6f5
to
3de5e89
Compare
@swift-ci please test |
1 similar comment
@swift-ci please test |
3de5e89
to
1862e69
Compare
@swift-ci please test macOS |
@swift-ci please test Windows |
@swift-ci please test macOS |
Instead of mangling class template specializations with the prefix "__CxxTemplateInst," simply set the decl name as the class templates plus the types that it is specialized on (so `vector<Int>` rather than `__CxxTemplateInstNSt3__16vectorIi...`). This is mainly to improve diagnostics. As a side effect of this change, if anyone copies the name of a class template specializaiton from an error/warning and uses it in source code, the compiler will error (that class templates aren't available in swift) rather than silently passing only to cause serailization failures down the road.
1862e69
to
ab15240
Compare
@swift-ci please test |
…lateSpec' through 'formDeclName'.
@swift-ci please test |
@swift-ci please test macOS |
Instead of mangling class template specializations with the prefix "__CxxTemplateInst," simply set the decl name as the class templates plus the types that it is specialized on (so
vector<Int>
rather than__CxxTemplateInstNSt3__16vectorIi...
).This is mainly to improve diagnostics. As a side effect of this change, if anyone copies the name of a class template specialization from an error/warning and uses it in source code, the compiler will error (that class templates aren't available in swift) rather than silently passing only to cause serialization failures down the road.