Commit Graph

717 Commits

Author SHA1 Message Date
Alan Donovan 17d0fe57ec go/gccgoexportdata: lost edits from review of CL 31822
Change-Id: I4d1eb36c2da5c7ad51989a1c9ab09b03019fd8f0
Reviewed-on: https://go-review.googlesource.com/31971
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-25 15:10:52 +00:00
Alan Donovan 5e7fa1cbaa go/gccgoexporter: an API for parsing gccgo export data
This package is provided as a stop-gap until gccgo uses the same export
data format as gc.  Once that occurs, this package will be deprecated
and eventually deleted.  The API is similar to (a subset of) gcexportdata.

Change-Id: I3398dbb8eab508a24d12036bbadaa60c2c1e77b3
Reviewed-on: https://go-review.googlesource.com/31822
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-25 15:07:10 +00:00
Alan Donovan 20055e012d go/internal/gccgoimporter: fork go/internal/gccgoimporter
The standard go/internal/gccgoimporter package is essentially unusable
behind the go/importer.For API, so this change makes a copy of it in
x/tools.  A follow-up change will expose a small but usable API to it.

Change-Id: Ica5092267ecafb78e1d983c86aa46e4e0bef02d5
Reviewed-on: https://go-review.googlesource.com/31854
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 21:32:26 +00:00
Alan Donovan b5ed9db83f go/gcexportdata: support old export data (again), needed by AE1.6
+ test

Change-Id: I0842795ece634e4441b17a10009d26bfc2a8481a
Reviewed-on: https://go-review.googlesource.com/31818
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 17:37:43 +00:00
Alan Donovan 0f7f54c9d9 go/gcexportdata: make test portable to MS Windows
Fixes issue #17565

Change-Id: I67d2e11acae873ac47694a73ced40d2db38c0fc0
Reviewed-on: https://go-review.googlesource.com/31813
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 16:32:43 +00:00
Alan Donovan 1a954d519b go/gcexportdata: a new simpler API for the deprecated go/gcimporter15
Fixes golang/go#15651

Change-Id: I7dc7ba731a22c677e3c01bf13e91ecfff9e46765
Reviewed-on: https://go-review.googlesource.com/30612
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-19 20:22:14 +00:00
Alan Donovan 8e53eb937b go/ssa: support custom TestMain functions in test packages
Supporting user-defined TestMain functions requires that we generate a
"testmain" package for each testable package, rather than a single one
for the entire program.  This entails these API changes:

1. (*ssa.Program).{CreateTestMainPackage,FindTests} both now
   accept only a single package.  Existing clients that pass them
   multiple packages must call them from a loop.

2. (*ssa.Program).FindTests returns an additional result, the the
   optional TestMain *ssa.Function.  Existing clients may discard it.

Also:
- Test the new logic using the SSA interpreter
- add ssautil.MainPackages helper
- callgraph: allow multiple main packages, and analyze them all
- ssadump -run: allow multiple main/test packages, and run each in a new interpreter
- minor simplifications to some callers (e.g. guru)

Fixes golang/go#9553

Change-Id: Ia7de9bd27448fb08b8d172ba5cdbcf37a762b7a0
Reviewed-on: https://go-review.googlesource.com/25102
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-19 17:50:59 +00:00
Rhys Hiltner af95c112ad go/ast/astutil: do not remove imports in AddNamedImport
When adding imports to an existing import declaration, ensure that
the target declaration will be printed with parentheses. This allows
all of the imported packages to be printed, not just the first one.

Fixes golang/go#17212

Change-Id: Ie5de5ec9bca6169650336ee2ea98334817e64e48
Reviewed-on: https://go-review.googlesource.com/29688
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-18 18:48:44 +00:00
Alan Donovan 2f93937767 x/tools: s/oracle/guru/g in various comments
Change-Id: Ie0da80db4f58d9f6e7d9675c89f106d1cd01710a
Reviewed-on: https://go-review.googlesource.com/30983
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:54:04 +00:00
Russ Cox b44548ae6a go/vcs: accept plain file for .vcs (instead of directory)
Sometimes .git is a plain file; maybe others will follow.

Fixes golang/go#10322.

Change-Id: Id57424998c207080c3ed5826b1e5e091fa26aad5
Reviewed-on: https://go-review.googlesource.com/21430
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-13 13:57:49 +00:00
Alan Donovan 992f6f9bcc go/loader: fix CreateFromFilenames example
The "sort" package is no longer quite as low-level as it once was.

Change-Id: Ic62d780841ef1172f65d4c00ec500994f94cb4b7
Reviewed-on: https://go-review.googlesource.com/30931
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-12 15:34:52 +00:00
David R. Jenni f4e1751b91 go/ast/astutil: handle documentation of imports in DeleteNamedImport.
If the parens of an ast.GenDecl are dropped, move the documentation
of the ImportSpec above the import statement, otherwise the the
code is invalid.

Fixes golang/go#15432.

Change-Id: I715750b8f528380b96a6bc8b5f216043937976c2
Reviewed-on: https://go-review.googlesource.com/22415
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-12 15:09:30 +00:00
Robert Griesemer b5358b5fee go/gcimporter15: update exportdata.go to match latest version from std lib
For golang/go#17281.

Change-Id: I7bed233368939719672eb331cca1d6aef01e807d
Reviewed-on: https://go-review.googlesource.com/30591
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-06 19:19:18 +00:00
Alan Donovan 03663480fa go/buildutil: ExpandPatterns: ignore a trailing slash in a pattern
Previously, a trailing slash would cause "foo/" to be treated as the
name of a package, with comical results.

Fixed golang/go#14584

Change-Id: I660f8a079bbd63d3645812e516a9264c8e080e61
Reviewed-on: https://go-review.googlesource.com/30452
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-05 19:34:25 +00:00
Rhys Hiltner c2ef61f450 go/ast/astutil: fix loop logic in AddNamedImport
When merging import declarations into a single block, AddNamedImport
modifies the list of declarations in the provided file while
iterating over the list. Take care to adjust the index into the list
so as to not skip entries or fall off the end.

Fixes golang/go#17213

Change-Id: I807246f762c965ea1fc51eb57759f6088336db86
Reviewed-on: https://go-review.googlesource.com/29681
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-24 00:48:36 +00:00
Alan Donovan 86ad1193da go/ssa/interp: turn {strings,bytes}.init into no-ops
...to avoid executing the supportAVX2 assembly function.

Also, combine all no-op intrinsics into a single function.

Change-Id: Ic65a80d3a6df52c3850c34406f034781057a0991
Reviewed-on: https://go-review.googlesource.com/28711
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-09-07 20:36:55 +00:00
Robert Griesemer 9deed8c6c1 go/gcimporter15: update to recognize export format version 2
Port of https://go-review.googlesource.com/#/c/27999/.

Change-Id: I71c4553e925fcf943ecafdef307591f63136d432
Reviewed-on: https://go-review.googlesource.com/28001
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-29 18:38:39 +00:00
Robert Griesemer a832035fe5 go/gcimporter15: update to match latest changes to cmd/compiler exporter
Backport of https://go-review.googlesource.com/27814 changes to
bexport.go.

With this, the gcimporter15 is again up-to-date and in sync with both
the compiler's export code, and the compiler's and std lib gcimporter's
import code.

Change-Id: I8e229660eb78ddc1506b7b96a89c81ff083e0412
Reviewed-on: https://go-review.googlesource.com/27914
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-26 22:16:59 +00:00
Robert Griesemer e545a4ce60 go/gcimporter15: update to match latest changes to std lib gcimporter
Mostly a backport of https://go-review.googlesource.com/27816.
Includes an update to TestIssue13898 to match the std lib gcimporter
test.

Change-Id: I790123a49deb2d52f19e51c84bbc7ee74c99156e
Reviewed-on: https://go-review.googlesource.com/27913
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-26 22:16:48 +00:00
Robert Griesemer b2560d12f6 go/gcimporter15: backport compiler exporter fix for golang/go#15514
Code from https://go-review.googlesource.com/#/c/27639/ .

Remain backward-compatible with possibly installed packages
that remain in Go1.6 format.

Change-Id: If424e7a881c81bbfcacf38c0946542793c406abd
Reviewed-on: https://go-review.googlesource.com/27640
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-23 23:43:11 +00:00
Robert Griesemer 2bbdb4568e go/gcimporter15: update to match std lib gcimporter (fix build)
TBR=adonovan

Change-Id: Ib2464def48932e0d0fc24f67c76a10e8918acb9d
Reviewed-on: https://go-review.googlesource.com/27235
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-08-23 00:37:51 +00:00
Robert Griesemer 1cf0a337cd go/gcimporter15: don't run 1.7-specific test under 1.8 (fix build)
TBR=adonovan

Change-Id: I310ff6e51d681b2e5c8288e73870ce7d68e45518
Reviewed-on: https://go-review.googlesource.com/27208
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-08-17 05:10:56 +00:00
David R. Jenni 491cbb1158 go/ast/astutil: add tests for UsesImport.
Change-Id: I05e9897b2ac858e1c3cc0d54f9da74e34f72f9e2
Reviewed-on: https://go-review.googlesource.com/27002
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-16 21:44:40 +00:00
Tim Henderson 1634796cc3 go/ssa: fix stale docs for CreateProgram and Build
Both functions had documentation referring to BuildAll when the
function is now called Build.

Change-Id: I59cce397a0a72bf7fa36f9798e2b07bb6b1da726
Reviewed-on: https://go-review.googlesource.com/25084
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-20 18:52:54 +00:00
Robert Griesemer c550f66b0b go/gcimporter15: backport of https://golang.org/cl/23606/
Change-Id: I24a6a844e179dd1b69c90c5834d7998cb963c543
Reviewed-on: https://go-review.googlesource.com/24974
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-15 21:35:32 +00:00
Robert Griesemer 3f933d433a go/gcimporter15: backport of https://golang.org/cl/23012/
Fixes golang/go#16365.

Change-Id: I8e33fbd9f1bf1b4b5d85a5c972ad43414cea57cb
Reviewed-on: https://go-review.googlesource.com/24973
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-15 21:35:22 +00:00
Robert Griesemer 6c3528d5c1 go/gcimporter15: backport https://golang.org/cl/24648/
Change-Id: Id85050b236f5da2c705c45163c90fef1a396e8f8
Reviewed-on: https://go-review.googlesource.com/24700
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-01 19:20:20 +00:00
Alan Donovan 0d2bde8553 go/ast/astutil: describe fewer CallExprs as "conversions"
Only unary CallExprs with no ellipsis, f(x), are ambiguous.

Change-Id: If4f17445ab0725dee916992db133eac5536133a7
Reviewed-on: https://go-review.googlesource.com/24552
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-06-30 18:40:56 +00:00
Monty Taylor 6d483ee832 vcs: Add support for git.openstack.org
Go is being proposed as an officially supported language for elements of
OpenStack:

  https://review.openstack.org/#/c/312267/

As such, repos that exist in OpenStack's git infrastructure
are likely to become places from which people might want to go get
things. Allow optional .git suffixes to allow writing code that
depends on git.openstack.org repos that will work with older go versions
while we wait for this support to roll out.

Change-Id: I1f7be6b7aae63f9c554dbcdbfa46855bcff321df
Reviewed-on: https://go-review.googlesource.com/23362
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 15:53:25 +00:00
Robert Griesemer fbb6674a74 go/gcimporter15: match recent changes to export format
This is a copy&paste fix of the changes in golang.org/cl/22839.

Fixes https://github.com/golang/lint/issues/207 .

Change-Id: I2c4850395c8aa330ea27ad629b21ac21b973ef75
Reviewed-on: https://go-review.googlesource.com/22963
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-10 02:37:36 +00:00
Alan Donovan 3f1f7eeff1 go/gcimporter15: set Pos attribute of decoded types.Objects
BImportData now requires a token.FileSet.
Column numbers are not exported, and are always reported as 1.
Line numbers greater than the limit (currently 64K) are reported as 1.

+ Test that file/line info is correctly preserved for the entire
  standard library.

Change-Id: I80cf370685320240dfb262d36fafd6cdf8569bfb
Reviewed-on: https://go-review.googlesource.com/22788
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-09 13:28:09 +00:00
Robert Griesemer 8dab6f1129 go/gcimporter15: adopt changes from golang.org/cl/22714
Fixes x/tools build.

Change-Id: Ifd958ff1293ec2c4fd971813ae7b199b5d8244fe
Reviewed-on: https://go-review.googlesource.com/22721
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-03 16:15:14 +00:00
Alan Donovan 686d0ad5b8 go/ssa: reduce set of expected indirect imports
...now that gc's export data records fewer dependencies.

Change-Id: Ie0f68f1f7b0825f6d2c100dfe189be017383db60
Reviewed-on: https://go-review.googlesource.com/22584
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 21:42:55 +00:00
Robert Griesemer c5c16cf68a go/gcimporter: update importer to match latest gc export data changes
Adjustments taken from https://golang.org/cl/22580.

Change-Id: Ic88137b410767bd17e3d6142cec2b5a112df56be
Reviewed-on: https://go-review.googlesource.com/22582
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 21:04:03 +00:00
Alan Donovan 56005b4126 go/ssa/interp: add intrinsic for runtime.NumGoroutine
...which is used by $GOROOT/test/goprint.go.

Change-Id: I4626b8fae3f87d9c8dd8cdcd8c05036955a36262
Reviewed-on: https://go-review.googlesource.com/22560
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 18:16:55 +00:00
Robert Griesemer 4e3242e000 go/gcimporter: cut off any gc-specific parameter numbering
Matching pending CL https://golang.org/cl/22441/.

Change-Id: I96fab1da7abfeb8f22ce680183649dfa4b84d461
Reviewed-on: https://go-review.googlesource.com/22442
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-25 22:17:50 +00:00
Robert Griesemer 487c81ee33 go/gcimporter15: match https://golang.org/cl/22385
Don't export position info for now. Enabled/disabled with a flag.
The importer recognizes the chosen format automatically.

Change-Id: I055818eb9dba50cc97f40eb92220258a1ddbfbec
Reviewed-on: https://go-review.googlesource.com/22427
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-25 20:08:02 +00:00
Robert Griesemer 764c4ccf44 go/gcimporter15: match https://golang.org/cl/22096/
Read and write position info.

Change-Id: Ibe4a914ff51911bbda656b08f1397132e495ab8a
Reviewed-on: https://go-review.googlesource.com/22098
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-15 16:49:27 +00:00
Robert Griesemer 5da1e91fb2 go/gcimporter15: match https://golang.org/cl/21939/
Plus cleanups from https://golang.org/cl/21963/.

Change-Id: Ifb216081581950f38d73bcb5f22e2ca7acd64f01
Reviewed-on: https://go-review.googlesource.com/21965
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 17:25:25 +00:00
Dominik Honnef 446a18e709 go/buildutil, cmd/guru: extract overlay context into buildutil
This extracts the overlay context and archive parsing from guru into
buildutil.

At least one tool (gogetdoc) has a vendored copy of this code already,
and more tools implementing the same functionality will follow.

The new code in buildutil is an almost identical copy of the code in
guru (names aside), except for the following changes:

- Instead of reading into a bytes.Buffer, we read directly into a []byte
  of appropriate size

- sameFile first attempts a simple comparison of path.Clean'ed paths.

Change-Id: I97cd978ccc10722e3648e5e10625fa7f1407f202
Reviewed-on: https://go-review.googlesource.com/21805
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 01:11:48 +00:00
Robert Griesemer b9ac36caf8 go/gcimporter15: match https://golang.org/cl/21896/
Change-Id: I1cd7a77617658c057c863bd311470f1f22062aee
Reviewed-on: https://go-review.googlesource.com/21900
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-12 19:34:05 +00:00
Alan Donovan 51487f711d x/tools: remove remaining files tagged for Go 1.4
(accidentally omitted from https://go-review.googlesource.com/20810)

Change-Id: Ib6ee4b2e43b6f32c5c0c031910087cc39d5c5d14
Reviewed-on: https://go-review.googlesource.com/21862
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-12 18:58:24 +00:00
Dmitri Shuralyov d601baae9c go/vcs: apply test style improvements from cmd/go
Apply style improvements to TestFromDir from golang/go@b6cd6d7d32,
in order to keep them in sync.

Check for error when creating a directory, its successful existence is a
precondition for the test to run.

Helps golang/go#11490.

Change-Id: I87054114c84aead96977f603ca3bd9eccfcfbd5e
Reviewed-on: https://go-review.googlesource.com/21795
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-12 07:00:54 +00:00
Dmitri Shuralyov 13c24a6d6a go/vcs: report correct directory for 'no version control'
Apply golang/go@b99fdb2a11.

Updates golang/go#6175.
Helps golang/go#11490.

Change-Id: I897bac1bac94b53e950cb5cf5e572d25a7c5996b
Reviewed-on: https://go-review.googlesource.com/21342
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-08 03:23:12 +00:00
Robert Griesemer 83f918d66b go/gcimporter15: update gcexporter to match gc export format
Change-Id: Icd84cbef6463ba584a2a29f01b23c7e4542d0101
Reviewed-on: https://go-review.googlesource.com/21618
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-06 22:12:38 +00:00
Robert Griesemer adaaa07486 x/tools: delete x/tools/go/types and dependent packages/client files
Per https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY
this change deletes the packages

  go/exact
  go/gccgoimporter
  go/gcimporter
  go/importer
  go/types
  cmd/vet

from the x/tools repo and any files depending on those packages
building against Go 1.4.

x/tools packages depending on any of these libraries must use the
respective versions from the std lib or use vendored versions if
building against 1.4.

Remaining packages may or may not build against Go 1.4 anymore
and will not be supported against 1.4.

Change-Id: I1c655fc30aee49b6c7326ebd4eb1bb0836ac97e0
Reviewed-on: https://go-review.googlesource.com/20810
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-06 21:52:49 +00:00
Robert Griesemer 44f369b779 gco/gcimporter15: update importer to match new gc binary export format
This is simply a copy of std lib's go/internal/gcimporter/bimport.go
with updated header comment and build tag. No semantic changes.

This will fix part of the x/tools build break at tip. The other part
is to adjust bexport.go (next CL).

Change-Id: Ibc37fae7e0d0447fdea9e3a733aa38589735c59a
Reviewed-on: https://go-review.googlesource.com/21543
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-05 20:22:26 +00:00
Alan Donovan 6361b5799a go/pointer: clarify a comment
Change-Id: Ia434ca4e7259cdb9a6f50d51432977fd31be27db
Reviewed-on: https://go-review.googlesource.com/21391
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-04-01 17:12:30 +00:00
Alan Donovan 84e7bc0dd3 go/loader: don't pass ldflags to cgo
Although these flags are harmless on linux, they
cause clang on darwin to issue an error about
unused flags (-lpthread).  We only care about compilation
so we don't need them.

Change-Id: I0fc756e2f4d7a829d43b5aa912c4e4b24a802a1c
Reviewed-on: https://go-review.googlesource.com/21283
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-29 18:37:41 +00:00
Alan Donovan 0ed9f242ee go/loader: update stdlib test after changes to stdlib
The os/user.lookup function no longer exists so instead we use
os/user.current.  (This function also existed in go1.5.)

Change-Id: Ic66d80acc186289331f1023e0145370feab6a001
Reviewed-on: https://go-review.googlesource.com/21281
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-29 16:31:44 +00:00