MCPcopy Create free account
hub / github.com/decomp/decomp / constZeroInitializer

Method constZeroInitializer

cmd/ll2go/constant.go:131–142  ·  view source on GitHub ↗

constZeroInitializer converts the given LLVM IR zero initializer constant to a corresponding Go expression.

(c *constant.ZeroInitializer)

Source from the content-addressed store, hash-verified

129// constZeroInitializer converts the given LLVM IR zero initializer constant to
130// a corresponding Go expression.
131func (d *decompiler) constZeroInitializer(c *constant.ZeroInitializer) ast.Expr {
132 // Somewhat of a hack, but works :)
133 //
134 // *new(T)
135 expr := &ast.CallExpr{
136 Fun: ast.NewIdent("new"),
137 Args: []ast.Expr{d.goType(c.Typ)},
138 }
139 return &ast.StarExpr{
140 X: expr,
141 }
142}
143
144// expr converts the given LLVM IR expression to a corresponding Go expression.
145func (d *decompiler) expr(expr constant.Expr) ast.Expr {

Callers 1

constantMethod · 0.95

Calls 1

goTypeMethod · 0.95

Tested by

no test coverage detected