Commit 494df875 by Ian Lance Taylor

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
parent 12f15468
fb44f62e7c01ebc987dad78875f593da18100007 e3271f3e09337b951822ba5c596d8cfe3b94508e
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -271,7 +271,7 @@ func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*a ...@@ -271,7 +271,7 @@ func typeCheckCgoSourceFiles(fset *token.FileSet, pkg *types.Package, files []*a
return importMap[path], nil return importMap[path], nil
}), }),
// TODO(adonovan): Sizes should probably be provided by analysis.Pass. // 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) Error: func(error) {}, // ignore errors (e.g. unused import)
} }
......
...@@ -236,4 +236,4 @@ func matchStructArgType(pass *analysis.Pass, t printfArgType, typ *types.Struct, ...@@ -236,4 +236,4 @@ func matchStructArgType(pass *analysis.Pass, t printfArgType, typ *types.Struct,
return true return true
} }
var archSizes = types.SizesFor("gc", build.Default.GOARCH) var archSizes = types.SizesFor("gccgo", build.Default.GOARCH)
...@@ -125,4 +125,4 @@ var ( ...@@ -125,4 +125,4 @@ var (
uintptrBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uintptr]) uintptrBitSize = 8 * archSizes.Sizeof(types.Typ[types.Uintptr])
) )
var archSizes = types.SizesFor("gc", build.Default.GOARCH) var archSizes = types.SizesFor("gccgo", build.Default.GOARCH)
...@@ -221,7 +221,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re ...@@ -221,7 +221,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re
}) })
tc := &types.Config{ tc := &types.Config{
Importer: importer, 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{ info := &types.Info{
Types: make(map[ast.Expr]types.TypeAndValue), Types: make(map[ast.Expr]types.TypeAndValue),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment