This is an archive of the discontinued LLVM Phabricator instance.

Add llvm-go tool.
ClosedPublic

Authored by pcc on Oct 21 2014, 6:53 PM.

Details

Summary

This tool lets us build LLVM components within the tree by setting up a
$GOPATH that resembles a tree fetched in the normal way with "go get".

It is intended that components such as the Go frontend will be built in-tree
using this tool.

TODO: autotools.

Diff Detail

Event Timeline

pcc updated this revision to Diff 15229.Oct 21 2014, 6:53 PM
pcc retitled this revision from to Add llvm-go tool..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: ruiu.
pcc added a subscriber: Unknown Object (MLST).
pcc updated this revision to Diff 15286.Oct 22 2014, 5:07 PM
  • Fix failure behavior, fix symlinks, allow environment variables to be set from command line
ruiu added inline comments.Oct 22 2014, 5:27 PM
bindings/go/build.sh
31

I think generated files shouldn't be written to the LLVM source tree. Instead it should be written to the build directory.

tools/llvm-go/llvm-go.go
36

compilerFlags

37

drop "flags" from field name.

104

This should be

args[i+1] = args[i+1] + " " + tag

?

121

You may want to a comment that this file is auto-generated by llvm-go.go.

153

Need to check the return value. On Windows I think it will return an error.

190

Check the error.

210

Print the help message if none above.

ruiu added inline comments.Oct 22 2014, 5:34 PM
tools/llvm-go/llvm-go.go
223

Go supports Java-like labeled for loop.

DONE:
for {
  switch {
  ...
  default:
    break DONE;
  }
}
pcc updated this revision to Diff 15289.Oct 22 2014, 6:24 PM
  • Address review comments, disable bindings on Windows
bindings/go/build.sh
31

Normally that is the case, but the build.sh script is used in the case where we go get LLVM, so there is no build directory as such.

I don't think we necessarily need to generate version.go though. Separately from this change, I'll investigate if we can change this to something else that does not require us to generate it here.

tools/llvm-go/llvm-go.go
36

Done.

37

Done.

104

Yes, done.

121

Done.

153

Done. That reminds me that I should disable the Go stuff altogether on Windows for now.

190

Done.

210

Done.

223

Done.

ruiu accepted this revision.Oct 22 2014, 6:47 PM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 22 2014, 6:47 PM
pcc closed this revision.Oct 22 2014, 7:43 PM
pcc updated this revision to Diff 15291.

Closed by commit rL220462 (authored by @pcc).