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

[Parser] Propagate debug locations like the old parser #6377

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

tlively
Copy link
Member

@tlively tlively commented Mar 5, 2024

Add a pass that propagates debug locations to unannotated child and sibling
expressions after parsing. The new parser on its own only attaches debug
locations to directly annotated instructions, but this pass, which we run
unconditionally, emulates the behavior of the previous parser for compatibility
with existing programs. It does unintuitive things to programs using the
non-nested format because it runs on nested Binaryen IR, so we may want to
rethink this at some point.

@tlively tlively requested a review from kripken March 5, 2024 02:13
@tlively
Copy link
Member Author

tlively commented Mar 5, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @tlively and the rest of your teammates on Graphite Graphite

Add a pass that propagates debug locations to unannotated child and sibling
expressions after parsing. The new parser on its own only attaches debug
locations to directly annotated instructions, but this pass, which we run
unconditionally, emulates the behavior of the previous parser for compatibility
with existing programs. It does unintuitive things to programs using the
non-nested format because it runs on nested Binaryen IR, so we may want to
rethink this at some point.
Super::doPreVisit(self, currp);
auto& locs = self->getFunction()->debugLocations;
auto& parentDefaults = self->parentDefaults;
if (auto it = locs.find(*currp); it != locs.end()) {
Copy link
Member

Choose a reason for hiding this comment

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

Can maybe do auto* curr = *currp; as it recurs.

@tlively tlively merged commit 6896d05 into main Mar 5, 2024
28 checks passed
@tlively tlively deleted the parser-propagate-debuglocs branch March 5, 2024 20:27
@gkdn gkdn mentioned this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants