]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: improve asmdecl parameter handling
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 10 Jul 2016 00:10:57 +0000 (17:10 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 22 Aug 2016 15:42:06 +0000 (15:42 +0000)
commit4af1148079f00b461c9ae79df22aa647aa7ff5ef
tree93cfa06aec958b2f2e70a90751f4836454464ced
parent880c967ccd71013253a751452a83e6c6a0cf86df
cmd/vet: improve asmdecl parameter handling

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: Rob Pike <r@golang.org>
src/cmd/vet/asmdecl.go
src/cmd/vet/testdata/asm.go
src/cmd/vet/testdata/asm1.s
src/runtime/sys_darwin_arm.s
src/runtime/sys_plan9_arm.s