cmd/internal/gc: more int to bool cleanups
- make paramoutheap return a bool
- convert Node.Assigned to a bool
- convert Node.Captured to a bool
- convert Node.Byval to a bool
- convert Node.Dupok to a bool
- convert Node.Wrapper to a bool
- convert Node.Reslice to a bool
Change-Id: I5b57c019f936c31d53db4db14459fb2b0aa72305
Reviewed-on: https://go-review.googlesource.com/7030
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
diff --git a/src/cmd/internal/gc/walk.go b/src/cmd/internal/gc/walk.go
index 7ba66b0..4814688 100644
--- a/src/cmd/internal/gc/walk.go
+++ b/src/cmd/internal/gc/walk.go
@@ -91,21 +91,21 @@
return a == b
}
-func paramoutheap(fn *Node) int {
+func paramoutheap(fn *Node) bool {
for l := fn.Dcl; l != nil; l = l.Next {
switch l.N.Class {
case PPARAMOUT,
PPARAMOUT | PHEAP:
- return bool2int(l.N.Addrtaken)
+ return l.N.Addrtaken
// stop early - parameters are over
case PAUTO,
PAUTO | PHEAP:
- return 0
+ return false
}
}
- return 0
+ return false
}
// adds "adjust" to all the argument locations for the call n.
@@ -284,7 +284,7 @@
if n.List == nil {
break
}
- if (Curfn.Type.Outnamed != 0 && count(n.List) > 1) || paramoutheap(Curfn) != 0 {
+ if (Curfn.Type.Outnamed != 0 && count(n.List) > 1) || paramoutheap(Curfn) {
// assign to the function out parameters,
// so that reorder3 can fix up conflicts
var rl *NodeList
@@ -2174,7 +2174,7 @@
// generate the write barrier directly in that case.
// (It does not yet, but the cost of the write barrier will be
// small compared to the cost of the allocation.)
- if r.Reslice != 0 {
+ if r.Reslice {
switch r.Op {
case OSLICE,
OSLICE3,