transform: modify output format from the -print-allocs flag to be the same as expected by the go coverage tool

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2026-02-24 14:34:13 +01:00
parent 180220a2e3
commit 9bdbe943ce
4 changed files with 62 additions and 19 deletions
+5 -1
View File
@@ -88,7 +88,11 @@ func Optimize(mod llvm.Module, config *compileopts.Config) []error {
// Run TinyGo-specific interprocedural optimizations.
OptimizeAllocs(mod, config.Options.PrintAllocs, maxStackSize, func(pos token.Position, msg string) {
fmt.Fprintln(os.Stderr, pos.String()+": "+msg)
if pos.Filename != "" {
fmt.Fprintf(os.Stderr, "%s:%d:%d: %s\n", pos.Filename, pos.Line, pos.Column, msg)
} else {
fmt.Fprintln(os.Stderr, msg) // No prefix!
}
})
OptimizeStringToBytes(mod)
OptimizeStringEqual(mod)