transform: add -print-allocs-cover and restore -print-allocs reason output#5460
Open
b0ch3nski wants to merge 1 commit into
Open
transform: add -print-allocs-cover and restore -print-allocs reason output#5460b0ch3nski wants to merge 1 commit into
b0ch3nski wants to merge 1 commit into
Conversation
0409b9b to
81666c4
Compare
dgryski
reviewed
Jun 11, 2026
|
|
||
| // FormatAlloc renders the message printed for a heap allocation that could not | ||
| // be stack allocated, or "" when nothing should be printed. | ||
| func FormatAlloc(pos token.Position, reason string, cover bool) string { |
Member
There was a problem hiding this comment.
I think this should be split into two routines rather than a single routine with a bool argument, and then at the call site you decide which formatter to call.
Contributor
Author
There was a problem hiding this comment.
Good idea, done 🙌
…utput PR tinygo-org#5220 changed -print-allocs output to the go coverage tool format, which replaced the original human-readable explanation of why each object had to be heap allocated. That explanation is useful on its own, so this restores it as the default behavior of -print-allocs and moves the coverage format behind a -print-allocs-cover flag. Signed-off-by: Piotr Bocheński <piotr@bochen.ski>
81666c4 to
76bb4db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5355.
PR #5220 changed
-print-allocsoutput to the go coverage tool format, which replaced the original human-readable explanation of why each object had to be heap allocated. That explanation is useful on its own, so this restores it as the default behavior of-print-allocsand moves the coverage format behind a-print-allocs-coverflag.I've also moved the expected allocations to the golden files for easier maintenance.
CC @applejag @digitalentity @deadprogram @soypat