diff options
-rw-r--r-- | src/codegen/mod.rs | 2 | ||||
-rw-r--r-- | src/ir/enum_ty.rs | 10 | ||||
-rw-r--r-- | src/ir/ty.rs | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 95ec8f9d..3d07e1d0 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2318,7 +2318,7 @@ impl CodeGenerator for Enum { let enum_ty = item.expect_type(); let layout = enum_ty.layout(ctx); - let repr = self.repr().map(|repr| ctx.resolve_type(repr.as_type_id_unchecked())); + let repr = self.repr().map(|repr| ctx.resolve_type(repr)); let repr = match repr { Some(repr) => { match *repr.canonical_type(ctx).kind() { diff --git a/src/ir/enum_ty.rs b/src/ir/enum_ty.rs index c02f0163..a23b6491 100644 --- a/src/ir/enum_ty.rs +++ b/src/ir/enum_ty.rs @@ -1,6 +1,6 @@ //! Intermediate representation for C/C++ enumerations. -use super::context::{BindgenContext, ItemId}; +use super::context::{BindgenContext, TypeId}; use super::item::Item; use super::ty::TypeKind; use clang; @@ -27,7 +27,7 @@ pub struct Enum { /// /// It's `None` if the enum is a forward declaration and isn't defined /// anywhere else, see `tests/headers/func_ptr_in_struct.h`. - repr: Option<ItemId>, + repr: Option<TypeId>, /// The different variants, with explicit values. variants: Vec<EnumVariant>, @@ -35,7 +35,7 @@ pub struct Enum { impl Enum { /// Construct a new `Enum` with the given representation and variants. - pub fn new(repr: Option<ItemId>, variants: Vec<EnumVariant>) -> Self { + pub fn new(repr: Option<TypeId>, variants: Vec<EnumVariant>) -> Self { Enum { repr: repr, variants: variants, @@ -43,7 +43,7 @@ impl Enum { } /// Get this enumeration's representation. - pub fn repr(&self) -> Option<ItemId> { + pub fn repr(&self) -> Option<TypeId> { self.repr } @@ -125,7 +125,7 @@ impl Enum { } CXChildVisit_Continue }); - Ok(Enum::new(repr, variants)) + Ok(Enum::new(repr.map(|r| r.as_type_id_unchecked()), variants)) } /// Whether the enum should be a bitfield diff --git a/src/ir/ty.rs b/src/ir/ty.rs index d119e9e4..54d7be6c 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -1280,7 +1280,7 @@ impl Trace for Type { TypeKind::Function(ref sig) => sig.trace(context, tracer, &()), TypeKind::Enum(ref en) => { if let Some(repr) = en.repr() { - tracer.visit(repr); + tracer.visit(repr.into()); } } TypeKind::UnresolvedTypeRef(_, _, Some(id)) => { |