golang.org/x/tools/go/analysis: pass "gccgo" to types.SizesFor

For the gofrontend copy, change calls to types.SizesFor to pass
    "gccgo" rather than "gc".  Leave the asmdecl pass unchanged since that
    pass is gc-specific anyhow.
    
    This has been fixed in a better way in the external repo by
    https://golang.org/cl/158317 and friends, but that is not in 1.12, so
    use this approach for now.
    
    Reviewed-on: https://go-review.googlesource.com/c/158842

From-SVN: r268153
This commit is contained in:
Ian Lance Taylor 2019-01-22 15:43:40 +00:00
parent 12f154688d
commit 494df8753b
5 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
fb44f62e7c01ebc987dad78875f593da18100007
e3271f3e09337b951822ba5c596d8cfe3b94508e
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.

View File

@ -271,7 +271,7 @@ func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*a
return importMap[path], nil
}),
// TODO(adonovan): Sizes should probably be provided by analysis.Pass.
Sizes: types.SizesFor("gc", build.Default.GOARCH),
Sizes: types.SizesFor("gccgo", build.Default.GOARCH),
Error: func(error) {}, // ignore errors (e.g. unused import)
}

View File

@ -236,4 +236,4 @@ func matchStructArgType(pass *analysis.Pass, t printfArgType, typ *types.Struct,
return true
}
var archSizes = types.SizesFor("gc", build.Default.GOARCH)
var archSizes = types.SizesFor("gccgo", build.Default.GOARCH)

View File

@ -125,4 +125,4 @@ var (
uintptrBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uintptr])
)
var archSizes = types.SizesFor("gc", build.Default.GOARCH)
var archSizes = types.SizesFor("gccgo", build.Default.GOARCH)

View File

@ -221,7 +221,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re
})
tc := &types.Config{
Importer: importer,
Sizes: types.SizesFor("gc", build.Default.GOARCH), // assume gccgo ≡ gc?
Sizes: types.SizesFor("gccgo", build.Default.GOARCH), // assume gccgo ≡ gc?
}
info := &types.Info{
Types: make(map[ast.Expr]types.TypeAndValue),