Skip to content

Commit b4fe23c

Browse files
committed
ir: Handle CXType_Auto.
1 parent d80b797 commit b4fe23c

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

libbindgen/src/ir/ty.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,17 @@ impl Type {
780780
return Err(ParseError::Continue);
781781
}
782782
}
783+
CXType_Auto => {
784+
let canonical = ty.canonical_type();
785+
786+
// We don't want to blow the stack.
787+
assert!(canonical != ty, "Couldn't find deduced type");
788+
return Self::from_clang_ty(potential_id,
789+
&canonical,
790+
location,
791+
parent_id,
792+
ctx);
793+
}
783794
// NOTE: We don't resolve pointers eagerly because the pointee type
784795
// might not have been parsed, and if it contains templates or
785796
// something else we might get confused, see the comment inside
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
#[repr(C)]
8+
#[derive(Debug, Copy)]
9+
pub struct Foo {
10+
pub _address: u8,
11+
}
12+
pub const Foo_kBar: bool = true;
13+
#[test]
14+
fn bindgen_test_layout_Foo() {
15+
assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
16+
assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
17+
}
18+
impl Clone for Foo {
19+
fn clone(&self) -> Self { *self }
20+
}

libbindgen/tests/headers/auto.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// bindgen-flags: -- -std=c++11
2+
// bindgen-unstable
3+
4+
class Foo {
5+
static constexpr auto kBar = 2 == 2;
6+
};

0 commit comments

Comments
 (0)