-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
mangle C++ ::std and ::std::allocator correctly #3873
Conversation
|
This should add enough to enable attempts to interface with std::vector from D. |
What? Mangling templates was the main motivation for moving windows C++ mangling into the frontend. eg |
|
@yebblies I was wrong, but the example still isn't mangling right. Will need more investigation. |
|
The issue with mangling for Win32 is entirely different, so shouldn't be the target of this PR. This one is ready to go. |
| @@ -1,279 +1,287 @@ | |||
|
|
|||
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.
You've screwed up the line endings in here.
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.
fixed
Just declare your own versions of |
I don't see how we can expect users to do that. |
c07e74a
to
1e335b3
Compare
| { | ||
| return true; | ||
| } | ||
| else |
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.
redundant control flow - just use
if (exist(p->isTemplateInstance()->tempdecl))
{
return true;
}
p = p->toParent();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.
p->isTemplateInstance() may return null, so it is not equivalent to your snippet.
|
This is awesome and lgtm modulo nits. @yebblies have your concerns been addressed? |
1e335b3
to
80e9cd1
Compare
Who said anything about users doing that? I'm saying do it in the test case, so this will pass on all platforms. One that note, why is this linux-only? Why no OSX?
@andralex No, they haven't. |
It was unclear what you were suggesting.
Since users will be using
OSX and FreeBSD added. |
80e9cd1
to
adcbad3
Compare
No, this test is about mangling, and it should just exercise the mangling. The D side certainly doesn't test anything else. If you want to add a test that actually uses vector I would have no problem with it, but let's not pretend that's what this one does.
You only added them to the C++ side. |
adcbad3
to
e066233
Compare
I implemented your other suggestions, thanks, but this one I disagree with. The idea is to test the mangling with the mangling in Also, |
Thankyou.
If it was a test that actually used
As I'm sure you know, dmc does not come with stl installed by default. Or are you not planning to support this on win32?
It's trivial extra work, which you already did on the D side.
I find it hard to believe that writing the C++ equivalent of extern (C++, std)
{
struct vector(T, A = allocator!T) { }
struct allocator(T) { }
}is a significant burden. |
|
Anyway, I'll merge it because my only objection is the test case and it's still better than no tests. |
|
Auto-merge toggled on |
|
thank you |
That would be good. I would have not have this objection if it was merged.
That's the whole point, it could work right now if you followed my suggestion instead of including vector.
This sounds similar to my argument about the elf headers. Maybe I am getting through after all! |
The test case would work, but the user still could not connect to |
Yes...? With your patch neither works. |
mangle C++ ::std and ::std::allocator correctly
On Linux, there are shortcut mangles for ::std and ::std::allocator which were not implemented.
Not done on Windows because C++ template mangling currently isn't done at all on Windows. Need to fix that with another PR.
Also wound up removing some tabs from the test files.