You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, clang::Cursor::fallible_semantic_parent calls clang::Cursor::semantic_parent and does some validation and error checking, and it is clang::Cursor::semantic_parent that does the ffi call to clang_getCursorSemanticParent. This means that clang::Cursor::semantic_parent isn't very safe, since the result was never validated. We should make fallible_semantic_parent do the ffi call and validation, and then have semantic_parent call fallible_semantic_parent().unwrap() so that we are properly verifying return values regardless what method we call.
I can mentor someone who would like to pick up this bug.
The text was updated successfully, but these errors were encountered:
…milio
Make clang::Cursor::fallible_semantic_parent make ffi call
This PR fixes#120 . `clang::Cursor::semantic_parent` now just calls `clang::Cursor::fallible_semantic_parent`, and the ffi call has been moved into `fallible_semantic_parent`.
This change broke a number of tests which call `is_toplevel()` (which itself calls `semantic_parent()`):
> panicked at called Option::unwrap() on a None value
So I re-wrote `is_toplevel()` to call `fallible_semantic_parent()`, which returns an `Option<Cursor>` type instead.
Right now,
clang::Cursor::fallible_semantic_parent
callsclang::Cursor::semantic_parent
and does some validation and error checking, and it isclang::Cursor::semantic_parent
that does the ffi call toclang_getCursorSemanticParent
. This means thatclang::Cursor::semantic_parent
isn't very safe, since the result was never validated. We should makefallible_semantic_parent
do the ffi call and validation, and then havesemantic_parent
callfallible_semantic_parent().unwrap()
so that we are properly verifying return values regardless what method we call.I can mentor someone who would like to pick up this bug.
The text was updated successfully, but these errors were encountered: