Skip to content

Commit 96e5d77

Browse files
author
bors-servo
authored
Auto merge of #352 - emilio:auto, r=fitzgen
ir: Handle CXType_Auto. Fixes #351
2 parents d80b797 + 50a3a6b commit 96e5d77

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

libbindgen/src/ir/ty.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,15 @@ impl Type {
780780
return Err(ParseError::Continue);
781781
}
782782
}
783+
CXType_Auto => {
784+
// We don't want to blow the stack.
785+
assert!(canonical_ty != *ty, "Couldn't find deduced type");
786+
return Self::from_clang_ty(potential_id,
787+
&canonical_ty,
788+
location,
789+
parent_id,
790+
ctx);
791+
}
783792
// NOTE: We don't resolve pointers eagerly because the pointee type
784793
// might not have been parsed, and if it contains templates or
785794
// 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)