summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/ty.rs11
-rw-r--r--src/ir/var.rs2
2 files changed, 8 insertions, 5 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index bf45b9fc..5765a78c 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -104,10 +104,13 @@ impl Type {
Self::new(Some(name), None, kind, false)
}
- pub fn is_integer_literal(&self) -> bool {
- match *self.kind() {
- TypeKind::Int(..) => true,
- _ => false,
+ pub fn is_integer(&self, ctx: &BindgenContext) -> bool {
+ match self.kind {
+ TypeKind::UnresolvedTypeRef(..) => false,
+ _ => match self.canonical_type(ctx).kind {
+ TypeKind::Int(..) => true,
+ _ => false,
+ }
}
}
diff --git a/src/ir/var.rs b/src/ir/var.rs
index 23529bcd..8e7f6c42 100644
--- a/src/ir/var.rs
+++ b/src/ir/var.rs
@@ -112,7 +112,7 @@ impl ClangSubItemParser for Var {
// tests/headers/inner_const.hpp
//
// That's fine because in that case we know it's not a literal.
- if context.safe_resolve_type(ty).map_or(false, |t| t.is_integer_literal()) {
+ if context.safe_resolve_type(ty).map_or(false, |t| t.is_integer(context)) {
// Try to parse a literal token value
cursor.visit(|c, _| {
if c.kind() == CXCursor_IntegerLiteral {