summaryrefslogtreecommitdiff
path: root/bindgen/clang.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2022-10-18 02:17:18 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-10-22 14:24:01 +0200
commit80738016a36e803fe3bf8b8f6f388c6589d86a1c (patch)
tree029672918da41492eb51972aeb133fa00040b999 /bindgen/clang.rs
parent0142c0aaf72a3859e319640224740965c2ddeab3 (diff)
clang: Detect anonymous items explicitly, rather than relying on empty names.
In Clang 16, anonymous items may return names like `(anonymous union at ..)` rather than empty names. The right way to detect them is using clang_Cursor_isAnonymous. Fixes #2312 Closes #2316 Co-Authored-by: Patrick Walton <pcwalton@fb.com>
Diffstat (limited to 'bindgen/clang.rs')
-rw-r--r--bindgen/clang.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/bindgen/clang.rs b/bindgen/clang.rs
index ae140520..32a25449 100644
--- a/bindgen/clang.rs
+++ b/bindgen/clang.rs
@@ -86,6 +86,11 @@ impl Cursor {
unsafe { clang_isDeclaration(self.kind()) != 0 }
}
+ /// Is this cursor's referent an anonymous record or so?
+ pub fn is_anonymous(&self) -> bool {
+ unsafe { clang_Cursor_isAnonymous(self.x) != 0 }
+ }
+
/// Get this cursor's referent's spelling.
pub fn spelling(&self) -> String {
unsafe { cxstring_into_string(clang_getCursorSpelling(self.x)) }