This is an archive of the discontinued LLVM Phabricator instance.

[Go] Subtypes function
ClosedPublic

Authored by TyanNN on Jun 5 2017, 10:01 AM.

Details

Summary

This patch adds LLVMGetSubtypes to Go API (as Type.Subtypes), tests included. Please commit this patch if/when everything's OK, as I do not have commit access

Diff Detail

Repository
rL LLVM

Event Timeline

TyanNN created this revision.Jun 5 2017, 10:01 AM
TyanNN retitled this revision from Add GetSubtypes to Go to [Go] GetSubtypes function.Jun 6 2017, 3:40 AM
deadalnix edited edge metadata.Jun 6 2017, 4:29 AM

I don't know go that much so I'll give the opportunity to someone that knows better checks this out.

TyanNN added a comment.Jun 6 2017, 4:34 AM

I don't know go that much so I'll give the opportunity to someone that knows better checks this out.

Well, svn blame said you did some things in go API, so i thought i might as well assign you too

axw requested changes to this revision.Jun 6 2017, 5:21 PM

Code looks fine, and thanks for adding a test. I just think this one should be a method rather than a free function.

bindings/go/llvm/ir.go
614 ↗(On Diff #101424)

I think this should be a method, similar to Type.ParamTypes. I suggest func (t Type) Subtypes() []Type.

bindings/go/llvm/ir_test.go
143 ↗(On Diff #101424)

Drop the semicolon, they're unnecessary in Go.

This revision now requires changes to proceed.Jun 6 2017, 5:21 PM
TyanNN updated this revision to Diff 101676.Jun 7 2017, 2:33 AM
TyanNN edited edge metadata.

Make GetSubtypes a member function of Type. Remove semicolon

axw added a comment.Jun 7 2017, 5:50 AM

Sorry, I shouldn't really have said *suggest*. Can you please rename GetSubtypes to Subtypes? GetFoo is not idiomatic in Go (there are some instances of GetFoo in the existing code, but they're stuck like that until someone decides to break compatibility).

TyanNN updated this revision to Diff 101716.Jun 7 2017, 5:55 AM
TyanNN retitled this revision from [Go] GetSubtypes function to [Go] Subtypes function.
TyanNN edited the summary of this revision. (Show Details)

Rename GetSubtypes to Subtypes

axw accepted this revision.Jun 8 2017, 12:28 AM

Thank you, I'll submit this shortly.

This revision is now accepted and ready to land.Jun 8 2017, 12:28 AM
This revision was automatically updated to reflect the committed changes.