diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-04 10:13:55 -0700 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2017-04-04 10:13:55 -0700 |
commit | f2ef3d1e7e4c4f78ea752538290f96670c68a8db (patch) | |
tree | c42db2cd0506f549304a511bb8ceee2505727cc5 | |
parent | 582aa969c70a69f19d2aedb4c418c32e1c99b3c0 (diff) |
Add warning when we fall back to opaque blobs
-rw-r--r-- | src/ir/context.rs | 2 | ||||
-rw-r--r-- | src/ir/ty.rs | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs index fa001ba6..6c11f7f9 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -425,6 +425,8 @@ impl<'ctx> BindgenContext<'ctx> { let _resolved = { let resolved = Item::from_ty(&ty, loc, parent_id, self) .unwrap_or_else(|_| { + warn!("Could not resolve type reference, falling back \ + to opaque blob"); Item::new_opaque_type(self.next_item_id(), &ty, self) }); let mut item = self.items.get_mut(&id).unwrap(); diff --git a/src/ir/ty.rs b/src/ir/ty.rs index a28727c9..594e4c03 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -1093,13 +1093,19 @@ impl Type { name = location.spelling(); } - if let Ok(complex) = CompInfo::from_ty(potential_id, - ty, - Some(location), - ctx) { - TypeKind::Comp(complex) - } else { - return Ok(ParseResult::New(Opaque::from_clang_ty(ty), None)); + let complex = CompInfo::from_ty(potential_id, + ty, + Some(location), + ctx); + match complex { + Ok(complex) => TypeKind::Comp(complex), + Err(_) => { + warn!("Could not create complex type \ + from class template or base \ + specifier, using opaque blob"); + let opaque = Opaque::from_clang_ty(ty); + return Ok(ParseResult::New(opaque, None)); + } } } CXCursor_TypeAliasTemplateDecl => { |