From d0b88d22069443bdde878336655982e9c012fa6b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 8 Jan 2014 15:25:17 -0800 Subject: [PATCH] cmd/gotype: add -gccgo flag R=gri CC=golang-codereviews, golang-dev https://golang.org/cl/39050043 --- cmd/gotype/doc.go | 2 ++ cmd/gotype/gotype.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/gotype/doc.go b/cmd/gotype/doc.go index cafa2322..e6893781 100644 --- a/cmd/gotype/doc.go +++ b/cmd/gotype/doc.go @@ -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 diff --git a/cmd/gotype/gotype.go b/cmd/gotype/gotype.go index 45808087..efc5a4c1 100644 --- a/cmd/gotype/gotype.go +++ b/cmd/gotype/gotype.go @@ -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) {