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 20742 - dmd -X (JSON output) includes uncompiled symbols #11044

Merged
merged 1 commit into from
Apr 20, 2020

Conversation

MoonlightSentinel
Copy link
Contributor

@MoonlightSentinel MoonlightSentinel commented Apr 17, 2020

PR #6621 took the code for pending ConditionalDeclarations from
doc.d but missed the early return.

CC @schveiguy

Reference:

dmd/src/dmd/doc.d

Lines 1202 to 1219 in 83a929e

override void visit(ConditionalDeclaration cd)
{
//printf("ConditionalDeclaration::emitComment(sc = %p)\n", sc);
if (cd.condition.inc != Include.notComputed)
{
visit(cast(AttribDeclaration)cd);
return;
}
/* If generating doc comment, be careful because if we're inside
* a template, then include(null) will fail.
*/
Dsymbols* d = cd.decl ? cd.decl : cd.elsedecl;
for (size_t i = 0; i < d.dim; i++)
{
Dsymbol s = (*d)[i];
emitComment(s, *buf, sc);
}
}

PR dlang#6621 took the code for pending `ConditionalDeclaration`s from
doc.d but missed the early return.
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @MoonlightSentinel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
20742 regression dmd -X (JSON output) includes uncompiled symbols

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#11044"

@schveiguy
Copy link
Member

Thanks! I will see if I can test this against the project I found it in to see if it fixes the issue.

Copy link
Member

@schveiguy schveiguy left a comment

Choose a reason for hiding this comment

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

I was able to checkout this PR and verify that it fixes the original problem I was having. Thanks!

@schveiguy
Copy link
Member

I'm reading the code, and I'm not sure how this works. What does d.condition.inc mean in this context? I'm ignorantly assuming this means "it was included", but I'm not sure why then it doesn't include the versioned out stuff.

I'm always interested in learning more about how the compiler works, but I never have been able to approach it...

@MoonlightSentinel
Copy link
Contributor Author

According to the documentation d.condition.inc stores whether the condition for a ConditionalDeclaration [version(...), statif if(...), template(?)] was met and henceforth should include the declaration.

dmd/src/dmd/cond.d

Lines 43 to 48 in e7b6012

enum Include
{
notComputed, /// not computed yet
yes, /// include the conditional code
no, /// do not include the conditional code
}

@schveiguy
Copy link
Member

schveiguy commented Apr 17, 2020

OK, that makes sense. So I'm still confused though, but I will move this to slack, as it's not really related to this PR. It seems to work, though I don't know how it works.

Edit: Ah, nevermind. I see that it's checking for "notComputed", not "notIncluded". 🤦

@schveiguy
Copy link
Member

Anyone with more experience who can review this? It seems simple, and it would be nice to get it into 2.091.1

@Geod24
Copy link
Member

Geod24 commented Apr 20, 2020

#11044 (comment)

Too late for this :(

@schveiguy
Copy link
Member

Forget waiting, this seems so simple, I'm just going to merge it. It's only the json output anyway.

@dlang-bot dlang-bot merged commit 9b15009 into dlang:stable Apr 20, 2020
@MoonlightSentinel MoonlightSentinel deleted the json-version branch May 11, 2020 12:34
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.

4 participants