Skip to content

Commit ec6cb2c

Browse files
kulpemilio
authored andcommitted
Introduce is_macro_function_like
1 parent c462892 commit ec6cb2c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/clang.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ impl Cursor {
239239
}
240240
}
241241

242+
/// Is this Cursor pointing to a function-like macro definition?
243+
/// Returns None if this cannot be determined with the available libclang
244+
/// (it requires 3.9 or greater).
245+
pub fn is_macro_function_like(&self) -> Option<bool> {
246+
if clang_Cursor_isMacroFunctionLike::is_loaded() {
247+
Some(unsafe { clang_Cursor_isMacroFunctionLike(self.x) != 0 })
248+
} else {
249+
None
250+
}
251+
}
252+
242253
/// Get the kind of referent this cursor is pointing to.
243254
pub fn kind(&self) -> CXCursorKind {
244255
self.x.kind

0 commit comments

Comments
 (0)