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

Option to generate a dot file representing the smir-json #34

Merged
merged 17 commits into from
Jan 30, 2025

Conversation

jberthold
Copy link
Member

@jberthold jberthold commented Jan 28, 2025

In this first version we don't draw the statements of blocks, just the block structure and caller/callee relations between blocks/items.

In terms of interface, the main program now has options --json and --dot which have to come first, and we default to --json if they are absent.

Output example: (main calls foo(0) calls bar(0))
image

The HS version had more color but was otherwise the same:
image

@jberthold
Copy link
Member Author

At the moment this does not have tests...
We could add golden tests as for the smir.json output, but we'd have to normalise the output in some way, too, which seems to be overdone for the purpose.

Copy link
Collaborator

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

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

This awesome for a first cut. Let's go with it as is and sometime down the track we can improve it. I'll approve now but I think we should add an issue for the statement printing, and an issue for testing the output. Also I think a line added to the README.md would be good. Even something as short as.

Experimental graph printing is available through the --dot flag

src/main.rs Outdated Show resolved Hide resolved
src/mk_graph.rs Show resolved Hide resolved
src/mk_graph.rs Outdated Show resolved Hide resolved
@jberthold jberthold merged commit 1cc3e92 into master Jan 30, 2025
1 check passed
@jberthold jberthold deleted the rs-generate-graph branch January 30, 2025 04:42
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.

2 participants