Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang::Cursor::ret_type should return an Option<Cursor> #131

Closed
fitzgen opened this issue Oct 25, 2016 · 5 comments
Closed

clang::Cursor::ret_type should return an Option<Cursor> #131

fitzgen opened this issue Oct 25, 2016 · 5 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Oct 25, 2016

Right now it always returns a Cursor but it makes an FFI call to clang_Cursor_getCursorResultType which is only valid if the cursor's referent is a function or method declarations and calls:

http://clang.llvm.org/doxygen/group__CINDEX__TYPES.html#ga6995a2d6352e7136868574b299005a63

This only returns a valid type if the cursor refers to a function or method.

We should check whether the cursor referent is a valid function/method call/decl kind, and if it is not, we should return None. This will be one less foot gun.

I can mentor whoever would like to pick up this bug.

@highfive
Copy link

Please make a comment here if you intend to work on this issue. Thank you!

@Natim
Copy link

Natim commented Nov 4, 2016

I am going to give it a try.

@Natim
Copy link

Natim commented Nov 4, 2016

clang::Cursor::ret_type should return an Option

I think it should return an Option<Type> instead of a Type correct?

@wafflespeanut
Copy link
Contributor

Precisely!

@Natim
Copy link

Natim commented Nov 4, 2016

Well I am kind of puzzled that the tests still pass 😞

bors-servo pushed a commit that referenced this issue Nov 4, 2016
…emilio

Make clang::Cursor::ret_type return an Option<Type> — Fixes #131

Well apparently nobody is using  `Cursor::ret_type` 😢
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants