cmd/gotype: add -gccgo flag

R=gri
CC=golang-codereviews, golang-dev
https://golang.org/cl/39050043
This commit is contained in:
Peter Collingbourne 2014-01-08 15:25:17 -08:00 committed by Robert Griesemer
parent 18b807c7ac
commit d0b88d2206
2 changed files with 9 additions and 0 deletions

View File

@ -27,6 +27,8 @@ The flags are:
report all errors (not just the first 10)
-v
verbose mode
-gccgo
use gccimporter instead of gcimporter
Debugging flags:
-seq

View File

@ -18,6 +18,7 @@ import (
"runtime"
"time"
"code.google.com/p/go.tools/go/gccgoimporter"
_ "code.google.com/p/go.tools/go/gcimporter"
"code.google.com/p/go.tools/go/types"
)
@ -27,6 +28,7 @@ var (
allFiles = flag.Bool("a", false, "use all (incl. _test.go) files when processing a directory")
allErrors = flag.Bool("e", false, "report all errors (not just the first 10)")
verbose = flag.Bool("v", false, "verbose mode")
gccgo = flag.Bool("gccgo", false, "use gccgoimporter instead of gcimporter")
// debugging support
sequential = flag.Bool("seq", false, "parse sequentially, rather than in parallel")
@ -195,6 +197,11 @@ func checkPkgFiles(files []*ast.File) {
},
Sizes: sizes,
}
if *gccgo {
var inst gccgoimporter.GccgoInstallation
inst.InitFromDriver("gccgo")
conf.Import = inst.GetImporter(nil)
}
defer func() {
switch p := recover().(type) {