summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clang.rs7
-rw-r--r--src/ir/context.rs3
-rw-r--r--src/ir/item.rs2
-rw-r--r--src/ir/ty.rs8
4 files changed, 11 insertions, 9 deletions
diff --git a/src/clang.rs b/src/clang.rs
index eefc7cf1..bac29ee3 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -50,13 +50,6 @@ impl Cursor {
unsafe { clang_isDeclaration(self.kind()) != 0 }
}
- /// Get the null cursor, which has no referent.
- pub fn null() -> Self {
- Cursor {
- x: unsafe { clang_getNullCursor() },
- }
- }
-
/// Get this cursor's referent's spelling.
pub fn spelling(&self) -> String {
unsafe { cxstring_into_string(clang_getCursorSpelling(self.x)) }
diff --git a/src/ir/context.rs b/src/ir/context.rs
index ee15bcf5..bd353a5f 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -686,7 +686,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
debug_assert!(
declaration.is_some() || !item.kind().is_type() ||
item.kind().expect_type().is_builtin_or_type_param() ||
- item.kind().expect_type().is_opaque(self, &item),
+ item.kind().expect_type().is_opaque(self, &item) ||
+ item.kind().expect_type().is_unresolved_ref(),
"Adding a type without declaration?"
);
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 75638ff3..a7ced3d0 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -1409,7 +1409,7 @@ impl ClangItemParser for Item {
parent_id.unwrap_or(current_module.into()),
ItemKind::Type(Type::new(None, None, kind, is_const)),
),
- Some(clang::Cursor::null()),
+ None,
None,
);
potential_id.as_type_id_unchecked()
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index 9cc097d4..ab39c19a 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -216,6 +216,14 @@ impl Type {
}
}
+ /// Is this an unresolved reference?
+ pub fn is_unresolved_ref(&self) -> bool {
+ match self.kind {
+ TypeKind::UnresolvedTypeRef(_, _, _) => true,
+ _ => false,
+ }
+ }
+
/// Is this a incomplete array type?
pub fn is_incomplete_array(&self, ctx: &BindgenContext) -> Option<ItemId> {
match self.kind {