Skip to content

Commit

Permalink
clang: Avoid a hot FFI call for getting the cursor kind.
Browse files Browse the repository at this point in the history
This is a sorta-hot call already.

I've noticed rust-lang#544 wants to add more assertions about this, and was going to
suggest moving them to `debug_assert!`.

But there's an easier way :)

Signed-off-by: Emilio Cobos Álvarez <[email protected]>
  • Loading branch information
emilio committed Feb 27, 2017
1 parent 4e4f092 commit cd55e94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Cursor {

/// Get the kind of referent this cursor is pointing to.
pub fn kind(&self) -> CXCursorKind {
unsafe { clang_getCursorKind(self.x) }
self.x.kind
}

/// Returns true is the cursor is a definition
Expand Down

0 comments on commit cd55e94

Please sign in to comment.