mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
transform: add -print-allocs-cover and restore -print-allocs reason output
PR #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>
This commit is contained in:
committed by
Ron Evans
parent
c33113ab5f
commit
4465360f3d
Vendored
+10
-10
@@ -10,7 +10,7 @@ func main() {
|
||||
derefInt(&n1)
|
||||
|
||||
// This should eventually be modified to not escape.
|
||||
n2 := 6 // OUT: allocs2.go:52.1,52.42 1 0
|
||||
n2 := 6
|
||||
returnIntPtr(&n2)
|
||||
|
||||
s1 := make([]int, 3)
|
||||
@@ -20,22 +20,22 @@ func main() {
|
||||
readIntSlice(s2[:])
|
||||
|
||||
// This should also be modified to not escape.
|
||||
s3 := make([]int, 3) // OUT: allocs2.go:51.1,51.42 1 0
|
||||
s3 := make([]int, 3)
|
||||
returnIntSlice(s3)
|
||||
|
||||
useSlice(make([]int, getUnknownNumber())) // OUT: allocs2.go:48.1,48.55 1 0
|
||||
useSlice(make([]int, getUnknownNumber()))
|
||||
|
||||
s4 := make([]byte, 300) // OUT: allocs2.go:46.1,46.56 1 0
|
||||
s4 := make([]byte, 300)
|
||||
readByteSlice(s4)
|
||||
|
||||
s5 := make([]int, 4) // OUT: allocs2.go:38.1,38.56 1 0
|
||||
s5 := make([]int, 4)
|
||||
_ = append(s5, 5)
|
||||
|
||||
s6 := make([]int, 3)
|
||||
s7 := []int{1, 2, 3}
|
||||
copySlice(s6, s7)
|
||||
|
||||
c1 := getComplex128() // OUT: allocs2.go:31.1,31.55 1 0
|
||||
c1 := getComplex128()
|
||||
useInterface(c1)
|
||||
|
||||
n3 := 5
|
||||
@@ -43,13 +43,13 @@ func main() {
|
||||
return n3
|
||||
}()
|
||||
|
||||
callVariadic(3, 5, 8) // OUT: allocs2.go:28.1,28.58 1 0
|
||||
callVariadic(3, 5, 8)
|
||||
|
||||
s8 := []int{3, 5, 8} // OUT: allocs2.go:26.1,26.76 1 0
|
||||
s8 := []int{3, 5, 8}
|
||||
callVariadic(s8...)
|
||||
|
||||
n4 := 3 // OUT: allocs2.go:23.1,23.55 1 0
|
||||
n5 := 7 // OUT: allocs2.go:13.1,13.42 1 0
|
||||
n4 := 3
|
||||
n5 := 7
|
||||
func() {
|
||||
n4 = n5
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user