-
-
Notifications
You must be signed in to change notification settings - Fork 668
do not emit mangling for inferred 'return' attribute #9476
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
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#9476" |
thewilsonator
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.
Tests?
| scopeinferred = (1L << 49), // 'scope' has been inferred and should not be part of mangling | ||
| future = (1L << 50), // introducing new base class function | ||
| local = (1L << 51), // do not forward (see dmd.dsymbol.ForwardingScopeDsymbol). | ||
| returninferred = (1L << 52), // 'return' has been inferred and should not be part of mangling |
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.
Wouldn't it be better to have just one STCinferred?
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.
Either return or scope or both can be present or inferred.
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'd not have expected inference to happen if either is explicitly given, but Ok.
Some of the bit flags may require a little pruning as there aren't many available left now.
7a35d19 to
cfa89e5
Compare
rainers
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.
I think the idea is correct.
| va.storage_class |= STC.scope_ | STC.scopeinferred; | ||
| va.storage_class |= v.storage_class & STC.return_; | ||
| if (v.storage_class & STC.return_) | ||
| va.storage_class |= STC.return_ | STC.returninferred; |
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.
Bad indentation.
Doesn't this need a check for pre-existing return annotation?
if (!(va.storage_class & STC.return_))
va.storage_class |= STC.return_ | STC.returninferred;
If scope and return can be inferred independently, the if-condition !va.isScope() seems to disallow that.
| static assert(typeof(foo).mangleof == "FNaNbNiNfPvZi"); | ||
|
|
||
| auto bar(void* p) { return p; } | ||
| static assert(typeof(bar).mangleof == "FNaNbNiNfPvZQd"); |
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.
Please also add tests that show explicit annotations make it to the mangling.
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.
see testscope2.d
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.
testscope2.d only runs with -dip25, but some of the code only affects -dip1000 AFAICT.
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.
BTW: you can also use core.demangle with CTFE for more readable asserts.
|
Wow! I gave compiling Phobos with -preview=dip1000 another shot with this. |
The idea is to get code binaries with and without -dip1000 to play together. This is already done for
scope.