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

Replace magic hasReturnExp bitflags with fields #17014

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Oct 18, 2024

The throw statement and assert(0) ones seem unused.

@dkorpel dkorpel added the Refactoring No semantic changes to code label Oct 18, 2024
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dkorpel! 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

Your 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 locally

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

dub run digger -- build "master + dmd#17014"

@dkorpel dkorpel marked this pull request as ready for review October 18, 2024 11:54
@dkorpel dkorpel requested a review from ibuclaw as a code owner October 18, 2024 11:54
Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

This otherwise looks great!

Silly questions:

Comment on lines -8138 to -8139
if (fd)
fd.hasReturnExp |= 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this removed with no replacement?

Comment on lines -3689 to -3691
if (FuncDeclaration fd = sc.parent.isFuncDeclaration())
fd.hasReturnExp |= 2;

Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@thewilsonator
Copy link
Contributor

Oh I see you said that in the opening comment.

@thewilsonator
Copy link
Contributor

Hmm. I still think it would be good to leave those in there, DMDaaL might want that. @RazvanN7 ?

@RazvanN7
Copy link
Contributor

It has happened in the past that fields that were unused in dmd were actually being used by users of dmdlib. That being said, I'm not sure what the policy should be here. Normally, you should be able to modify the compiler code however you wish, but this means breaking people's code. To a certain extent that's a given (and not a problem, provided that there are alternative ways in which you can obtain the needed information), however, there are situations where the compiler stores some information that is very hard to obtain if one would not have the ability to simply access it (see [1] for an example and its revert [2]).

As a compiler developer, I understand the need to optimize the code as much as possible. As a dmdlib library user I'd wish that the compiler stores as much information as possible so that I can use it. I think that the best way to proceed, generally, is to not delete information that might be useful, even if at a first glance it seems that the compiler is not using it. In this particular case, I will have Vladut I have look - it might be possible that we are using some of the deleted bits in D-scanner.

[1] #15241
[2] #16193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactoring No semantic changes to code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants