diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-12-28 04:25:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-28 04:25:23 -0800 |
commit | ce5d5c8d07e7dc68270967ad30f8f7c0ac9041c9 (patch) | |
tree | cc3ec43bcb2c1ca9a7a160711efec5f3658a8a73 /libbindgen/src | |
parent | ba1cb0a005cae7b7eac48673d1af317f181325b1 (diff) | |
parent | f7a328a2406e98d93a10453c613f675ce51471a9 (diff) |
Auto merge of #367 - emilio:auto-redux, r=upsuper
ir: More generic handling of non-deductible auto types.
Also, merge auto-related tests in `auto.hpp`.
r? @upsuper
Diffstat (limited to 'libbindgen/src')
-rw-r--r-- | libbindgen/src/ir/comp.rs | 6 | ||||
-rw-r--r-- | libbindgen/src/ir/ty.rs | 7 | ||||
-rw-r--r-- | libbindgen/src/ir/var.rs | 11 |
3 files changed, 17 insertions, 7 deletions
diff --git a/libbindgen/src/ir/comp.rs b/libbindgen/src/ir/comp.rs index 1c69e618..ea3850cc 100644 --- a/libbindgen/src/ir/comp.rs +++ b/libbindgen/src/ir/comp.rs @@ -748,9 +748,9 @@ impl CompInfo { return CXChildVisit_Continue; } - let item = Item::parse(cur, Some(potential_id), ctx) - .expect("VarDecl"); - ci.inner_vars.push(item); + if let Ok(item) = Item::parse(cur, Some(potential_id), ctx) { + ci.inner_vars.push(item); + } } // Intentionally not handled CXCursor_CXXAccessSpecifier | diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs index b04afeb6..6859b753 100644 --- a/libbindgen/src/ir/ty.rs +++ b/libbindgen/src/ir/ty.rs @@ -776,8 +776,11 @@ impl Type { } } CXType_Auto => { - // We don't want to blow the stack. - assert!(canonical_ty != *ty, "Couldn't find deduced type"); + if canonical_ty == *ty { + debug!("Couldn't find deduced type: {:?}", ty); + return Err(ParseError::Continue); + } + return Self::from_clang_ty(potential_id, &canonical_ty, location, diff --git a/libbindgen/src/ir/var.rs b/libbindgen/src/ir/var.rs index 518141c6..d9160eca 100644 --- a/libbindgen/src/ir/var.rs +++ b/libbindgen/src/ir/var.rs @@ -186,8 +186,15 @@ impl ClangSubItemParser for Var { // XXX this is redundant, remove! let is_const = ty.is_const(); - let ty = Item::from_ty(&ty, Some(cursor), None, ctx) - .expect("Unable to resolve constant type?"); + let ty = match Item::from_ty(&ty, Some(cursor), None, ctx) { + Ok(ty) => ty, + Err(e) => { + assert_eq!(ty.kind(), CXType_Auto, + "Couldn't resolve constant type, and it \ + wasn't an nondeductible auto type!"); + return Err(e); + } + }; // Note: Ty might not be totally resolved yet, see // tests/headers/inner_const.hpp |