Skip to content

Commit c65dd92

Browse files
committed
Change a call to add_item that was passing a NullCursor.
1 parent 40d24bb commit c65dd92

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/clang.rs

-7
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ impl Cursor {
5050
unsafe { clang_isDeclaration(self.kind()) != 0 }
5151
}
5252

53-
/// Get the null cursor, which has no referent.
54-
pub fn null() -> Self {
55-
Cursor {
56-
x: unsafe { clang_getNullCursor() },
57-
}
58-
}
59-
6053
/// Get this cursor's referent's spelling.
6154
pub fn spelling(&self) -> String {
6255
unsafe { cxstring_into_string(clang_getCursorSpelling(self.x)) }

src/ir/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ If you encounter an error missing from this list, please file an issue or a PR!"
686686
debug_assert!(
687687
declaration.is_some() || !item.kind().is_type() ||
688688
item.kind().expect_type().is_builtin_or_type_param() ||
689-
item.kind().expect_type().is_opaque(self, &item),
689+
item.kind().expect_type().is_opaque(self, &item) ||
690+
item.kind().expect_type().is_unresolved_ref(),
690691
"Adding a type without declaration?"
691692
);
692693

src/ir/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ impl ClangItemParser for Item {
14091409
parent_id.unwrap_or(current_module.into()),
14101410
ItemKind::Type(Type::new(None, None, kind, is_const)),
14111411
),
1412-
Some(clang::Cursor::null()),
1412+
None,
14131413
None,
14141414
);
14151415
potential_id.as_type_id_unchecked()

src/ir/ty.rs

+8
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ impl Type {
216216
}
217217
}
218218

219+
/// Is this an unresolved reference?
220+
pub fn is_unresolved_ref(&self) -> bool {
221+
match self.kind {
222+
TypeKind::UnresolvedTypeRef(_, _, _) => true,
223+
_ => false,
224+
}
225+
}
226+
219227
/// Is this a incomplete array type?
220228
pub fn is_incomplete_array(&self, ctx: &BindgenContext) -> Option<ItemId> {
221229
match self.kind {

0 commit comments

Comments
 (0)