Skip to content

ir: Handle CXType_Auto. #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libbindgen/src/ir/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,15 @@ impl Type {
return Err(ParseError::Continue);
}
}
CXType_Auto => {
// We don't want to blow the stack.
assert!(canonical_ty != *ty, "Couldn't find deduced type");
return Self::from_clang_ty(potential_id,
&canonical_ty,
location,
parent_id,
ctx);
}
// NOTE: We don't resolve pointers eagerly because the pointee type
// might not have been parsed, and if it contains templates or
// something else we might get confused, see the comment inside
Expand Down
20 changes: 20 additions & 0 deletions libbindgen/tests/expectations/tests/auto.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* automatically generated by rust-bindgen */


#![allow(non_snake_case)]


#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
pub _address: u8,
}
pub const Foo_kBar: bool = true;
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
}
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
6 changes: 6 additions & 0 deletions libbindgen/tests/headers/auto.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// bindgen-flags: -- -std=c++11
// bindgen-unstable

class Foo {
static constexpr auto kBar = 2 == 2;
};