github.com/v2fly/tools@v0.100.0/go/pointer/print.go (about)

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pointer
     6  
     7  import "fmt"
     8  
     9  func (c *addrConstraint) String() string {
    10  	return fmt.Sprintf("addr n%d <- {&n%d}", c.dst, c.src)
    11  }
    12  
    13  func (c *copyConstraint) String() string {
    14  	return fmt.Sprintf("copy n%d <- n%d", c.dst, c.src)
    15  }
    16  
    17  func (c *loadConstraint) String() string {
    18  	return fmt.Sprintf("load n%d <- n%d[%d]", c.dst, c.src, c.offset)
    19  }
    20  
    21  func (c *storeConstraint) String() string {
    22  	return fmt.Sprintf("store n%d[%d] <- n%d", c.dst, c.offset, c.src)
    23  }
    24  
    25  func (c *offsetAddrConstraint) String() string {
    26  	return fmt.Sprintf("offsetAddr n%d <- n%d.#%d", c.dst, c.src, c.offset)
    27  }
    28  
    29  func (c *typeFilterConstraint) String() string {
    30  	return fmt.Sprintf("typeFilter n%d <- n%d.(%s)", c.dst, c.src, c.typ)
    31  }
    32  
    33  func (c *untagConstraint) String() string {
    34  	return fmt.Sprintf("untag n%d <- n%d.(%s)", c.dst, c.src, c.typ)
    35  }
    36  
    37  func (c *invokeConstraint) String() string {
    38  	return fmt.Sprintf("invoke n%d.%s(n%d ...)", c.iface, c.method.Name(), c.params)
    39  }
    40  
    41  func (n nodeid) String() string {
    42  	return fmt.Sprintf("n%d", n)
    43  }