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

Repository
rL LLVM

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 ↗(On Diff #15229)

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
35 ↗(On Diff #15229)

compilerFlags

36 ↗(On Diff #15229)

drop "flags" from field name.

103 ↗(On Diff #15229)

This should be

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

?

120 ↗(On Diff #15229)

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

152 ↗(On Diff #15229)

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

189 ↗(On Diff #15229)

Check the error.

209 ↗(On Diff #15229)

Print the help message if none above.

ruiu added inline comments.Oct 22 2014, 5:34 PM
tools/llvm-go/llvm-go.go
223 ↗(On Diff #15286)

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 ↗(On Diff #15229)

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
223 ↗(On Diff #15286)

Done.

35 ↗(On Diff #15229)

Done.

36 ↗(On Diff #15229)

Done.

103 ↗(On Diff #15229)

Yes, done.

120 ↗(On Diff #15229)

Done.

152 ↗(On Diff #15229)

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

189 ↗(On Diff #15229)

Done.

209 ↗(On Diff #15229)

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).