aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Burke <kev@inburke.com>2016-11-11 16:56:07 -0800
committerMatthew Dempsky <mdempsky@google.com>2016-11-30 00:14:52 +0000
commit655a4e1284dadf3507a13b408d21900008e44221 (patch)
treef6056b68471a10ad58efd0edbe207529711e4998
parent0dd7e409e15d9b47d28cec422a41dd980b1479f0 (diff)
downloadgo-655a4e1284dadf3507a13b408d21900008e44221.tar.gz
go-655a4e1284dadf3507a13b408d21900008e44221.zip
cmd/compile/internal/gc: document variables and functions
Change-Id: I01b2278eb50585331b8ff7ff5e3c1f9c5ba52b63 Reviewed-on: https://go-review.googlesource.com/33156 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
-rw-r--r--src/cmd/compile/internal/gc/go.go4
-rw-r--r--src/cmd/compile/internal/gc/main.go4
-rw-r--r--src/cmd/compile/internal/gc/subr.go2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go
index d427755386..ff33e9c1c4 100644
--- a/src/cmd/compile/internal/gc/go.go
+++ b/src/cmd/compile/internal/gc/go.go
@@ -119,8 +119,12 @@ var linkobj string
var bout *bio.Writer
+// nerrors is the number of compiler errors reported
+// since the last call to saveerrors.
var nerrors int
+// nsavederrors is the total number of compiler errors
+// reported before the last call to saveerrors.
var nsavederrors int
var nsyntaxerrors int
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index edb37c2c74..75f58a731c 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -98,6 +98,9 @@ func supportsDynlink(arch *sys.Arch) bool {
var timings Timings
var benchfile string
+// Main parses flags and Go source files specified in the command-line
+// arguments, type-checks the parsed Go package, compiles functions to machine
+// code, and finally writes the compiled package definition to disk.
func Main() {
timings.Start("fe", "init")
@@ -483,6 +486,7 @@ func Main() {
errorexit()
}
+ // Write object data to disk.
timings.Start("be", "dumpobj")
dumpobj()
if asmhdr != "" {
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index fb5419f533..a53ba1fffc 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -58,6 +58,8 @@ func (x byLineno) Len() int { return len(x) }
func (x byLineno) Less(i, j int) bool { return x[i].lineno < x[j].lineno }
func (x byLineno) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+// flusherrors sorts errors seen so far by line number, prints them to stdout,
+// and empties the errors array.
func flusherrors() {
Ctxt.Bso.Flush()
if len(errors) == 0 {