summaryrefslogtreecommitdiffstats
path: root/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go
diff options
context:
space:
mode:
authorAndrew Wilkins <axwalk@gmail.com>2016-03-15 05:36:43 +0000
committerAndrew Wilkins <axwalk@gmail.com>2016-03-15 05:36:43 +0000
commit6436a4abd7a2f3a60b230453295dba199d8a59c3 (patch)
tree125aef80fc2cf46c5d1758a8ece1fde14e7b13fd /llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go
parent36761bf92427846ce40fdd849615732c852e44dd (diff)
downloadbcm5719-llvm-6436a4abd7a2f3a60b230453295dba199d8a59c3.tar.gz
bcm5719-llvm-6436a4abd7a2f3a60b230453295dba199d8a59c3.zip
[llgo] Roll gofrontend forward
Switch gofrontend to using go.googlesource.com, and update to 81eb6a3f425b2158c67ee32c0cc973a72ce9d6be. There are various changes required to update to the go 1.5 runtime: typemap.go is changed to accommodate the change in representation for equal/hash algorithms, and the removal of the zero value/type. CMakeLists.txt is updated to add the build tree to the package search path, so internal packages, which are not installed, are found. various files changes due to removal of __go_new_nopointers; the same change as in D11863, but with NoUnwindAttribute added to the added runtime functions which are called with "callOnly". minor cleanups in ssa.go while investigating issues with unwinding/panic handling. Differential Revisision: http://reviews.llvm.org/D15188 llvm-svn: 263536
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go')
-rw-r--r--llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go30
1 files changed, 14 insertions, 16 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go
index 48257fc6c4d..c8cd1610baf 100644
--- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go
+++ b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go
@@ -6,7 +6,7 @@
// TODO(rsc):
// Emit correct line number annotations.
-// Make 6g understand the annotations.
+// Make gc understand the annotations.
package main
@@ -33,6 +33,7 @@ type Package struct {
PtrSize int64
IntSize int64
GccOptions []string
+ GccIsClang bool
CgoFlags map[string][]string // #cgo flags (CFLAGS, LDFLAGS)
Written map[string]bool
Name map[string]*Name // accumulated Name from Files
@@ -87,7 +88,7 @@ type Name struct {
Const string // constant definition
}
-// IsVar returns true if Kind is either "var" or "fpvar"
+// IsVar reports whether Kind is either "var" or "fpvar"
func (n *Name) IsVar() bool {
return n.Kind == "var" || n.Kind == "fpvar"
}
@@ -98,6 +99,7 @@ func (n *Name) IsVar() bool {
type ExpFunc struct {
Func *ast.FuncDecl
ExpName string // name to use from C
+ Doc string
}
// A TypeRepr contains the string representation of a type.
@@ -174,15 +176,18 @@ var cPrefix string
var fset = token.NewFileSet()
var dynobj = flag.String("dynimport", "", "if non-empty, print dynamic import data for that file")
-var dynout = flag.String("dynout", "", "write -dynobj output to this file")
-var dynlinker = flag.Bool("dynlinker", false, "record dynamic linker information in dynimport mode")
+var dynout = flag.String("dynout", "", "write -dynimport output to this file")
+var dynpackage = flag.String("dynpackage", "main", "set Go package for -dynimport output")
+var dynlinker = flag.Bool("dynlinker", false, "record dynamic linker information in -dynimport mode")
-// These flags are for bootstrapping a new Go implementation,
-// to generate Go and C headers that match the data layout and
+// This flag is for bootstrapping a new Go implementation,
+// to generate Go types that match the data layout and
// constant values used in the host's C libraries and system calls.
var godefs = flag.Bool("godefs", false, "for bootstrap: write Go definitions for C file to standard output")
-var cdefs = flag.Bool("cdefs", false, "for bootstrap: write C definitions for C file to standard output")
+
var objDir = flag.String("objdir", "", "object directory")
+var importPath = flag.String("importpath", "", "import path of package being built (for comments in generated files)")
+var exportHeader = flag.String("exportheader", "", "where to write export header if any exported functions")
var gccgo = flag.Bool("gccgo", false, "generate files for use with gccgo")
var gccgoprefix = flag.String("gccgoprefix", "", "-fgo-prefix option used with gccgo")
@@ -208,12 +213,7 @@ func main() {
return
}
- if *godefs && *cdefs {
- fmt.Fprintf(os.Stderr, "cgo: cannot use -cdefs and -godefs together\n")
- os.Exit(2)
- }
-
- if *godefs || *cdefs {
+ if *godefs {
// Generating definitions pulled from header files,
// to be checked into Go repositories.
// Line numbers are just noise.
@@ -305,14 +305,12 @@ func main() {
p.Record(f)
if *godefs {
os.Stdout.WriteString(p.godefs(f, input))
- } else if *cdefs {
- os.Stdout.WriteString(p.cdefs(f, input))
} else {
p.writeOutput(f, input)
}
}
- if !*godefs && !*cdefs {
+ if !*godefs {
p.writeDefs()
}
if nerrors > 0 {
OpenPOWER on IntegriCloud