• Josh Bleecher Snyder's avatar
    cmd/vet: improve asmdecl parameter handling · 4af11480
    Josh Bleecher Snyder authored
    The asmdecl check had hand-rolled code that
    calculated the size and offset of parameters
    based only on the AST.
    It included a list of known named types.
    
    This CL changes asmdecl to use go/types instead.
    This allows us to easily handle named types.
    It also adds support for structs, arrays,
    and complex parameters.
    
    It improves the default names given to unnamed
    parameters. Previously, all anonymous arguments were
    called "unnamed", and the first anonymous return
    argument was called "ret".
    Anonymous arguments are now called arg, arg1, arg2,
    etc., depending on the index in the argument list.
    Return arguments are ret, ret1, ret2.
    
    This CL also fixes a bug in the printing of
    composite data type sizes.
    
    Updates #11041
    
    Change-Id: I1085116a26fe6199480b680eff659eb9ab31769b
    Reviewed-on: https://go-review.googlesource.com/27150
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    4af11480
asm.go 1.01 KB