Skip to content
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

fix Issue 5212 - no escape analysis for typesafe variadic function ar… #7976

Merged
merged 1 commit into from
Mar 3, 2018

Conversation

WalterBright
Copy link
Member

@WalterBright WalterBright commented Mar 3, 2018

…guments

The fix is implicitly adding the scope annotation.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
5212 normal no escape analysis for typesafe variadic function arguments

@WalterBright WalterBright force-pushed the fix5212 branch 3 times, most recently from 7e5563d to 379633b Compare March 3, 2018 08:29
Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation is fine, though not sure on your comment style and positioning.

fparam.storageClass |= STC.variadic;
/* Don't need to set STC.scope_ because this will only
* be evaluated at compile time
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't comments come before code in a block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other change, the setting of STC.scope_ came after.

@@ -604,7 +604,7 @@ private bool functionParameters(Loc loc, Scope* sc, TypeFunction tf, Type tthis,
nargs++;
}

if (tf.varargs == 2 && i + 1 == nparams)
if (tf.varargs == 2 && i + 1 == nparams) // https://dlang.org/spec/function.html#variadic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the link should be put on the line before this condition. Perhaps with a slight introduction also, eg: Handle variadic arguments as per spec <link>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec link implies just that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment still - to me at least - looks to be in an awkward place. But well, eye of the beholder and all.

/* Since it'll be pointing into the stack for the array
* contents, it needs to be `scope`
*/
stc |= STC.scope_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiline indent should probably be given braces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants