summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Kulp <darren@kulp.ch>2020-06-20 09:47:30 -0700
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-06-21 01:40:52 +0200
commitec6cb2c7c4fc707f9b8ca2a700b6b4f252a3c6e6 (patch)
tree3dd361501bdfce4b6f30b6ec3e8e4163e97cac1b
parentc462892ad1f2de2599aa6b2cbb6d3ca3e47d6db1 (diff)
Introduce is_macro_function_like
-rw-r--r--src/clang.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/clang.rs b/src/clang.rs
index f5f4fa1a..c3def94d 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -239,6 +239,17 @@ impl Cursor {
}
}
+ /// Is this Cursor pointing to a function-like macro definition?
+ /// Returns None if this cannot be determined with the available libclang
+ /// (it requires 3.9 or greater).
+ pub fn is_macro_function_like(&self) -> Option<bool> {
+ if clang_Cursor_isMacroFunctionLike::is_loaded() {
+ Some(unsafe { clang_Cursor_isMacroFunctionLike(self.x) != 0 })
+ } else {
+ None
+ }
+ }
+
/// Get the kind of referent this cursor is pointing to.
pub fn kind(&self) -> CXCursorKind {
self.x.kind