-
Notifications
You must be signed in to change notification settings - Fork 747
clang::Cursor::typedef_type should return Option<Type> #129
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
Comments
Please make a comment here if you intend to work on this issue. Thank you! |
How difficult is this? I am just getting my foots wet with rust. I am almost halfway through the Rust book form the website. |
@codingHahn, I think you should be able to handle this, it is pretty straight forward. You don't actually need to do the check before the FFI call, you can instead check the validity of the resulting cursor. Something like this: let inner = Type {
x: unsafe { clang_getTypedefDeclUnderlyingType(self.x) }
};
if inner.is_valid() { Some(inner) } else { None } Then, you'll need to fix up the places where we call this method. For each call site: if the call site is explicitly checking the resulting cursor for validity, change that to an Does that make sense? Would you like to take this issue? |
Ok. I should implement the check inside the function and return |
Yep that sounds right! Let me know if you run into any roadblocks. |
I'll let you know :) |
@codingHahn Have you done any progress on that or I can take it? |
The FFI call that
typedef_type
makes will return an invalid type if the cursor's referent is not a typedef. We should check whether the referent is a typedef and returnNone
if it is not, and make the FFI call and returnSome
if it is a typedef. This would be one less foot gun.I can mentor anyone who'd like to pick up this bug.
The text was updated successfully, but these errors were encountered: