Skip to content

Commit 2468fb2

Browse files
committed
ir: context: fall back to use the declaration as a key when there's no USR.
Apparently MSVC isn't that good at giving us USRs... Fixes #271
1 parent 9380ed5 commit 2468fb2

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

libbindgen/src/ir/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'ctx> BindgenContext<'ctx> {
222222
error!("Valid declaration with no USR: {:?}, {:?}",
223223
declaration,
224224
location);
225-
return;
225+
TypeKey::Declaration(declaration)
226226
};
227227

228228
let old = self.types.insert(key, id);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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 A {
10+
pub foo: usize,
11+
}
12+
#[test]
13+
fn bindgen_test_layout_A() {
14+
assert_eq!(::std::mem::size_of::<A>() , 8usize);
15+
assert_eq!(::std::mem::align_of::<A>() , 8usize);
16+
}
17+
impl Clone for A {
18+
fn clone(&self) -> Self { *self }
19+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
typedef unsigned long long size_t;
3+
4+
class A {
5+
const size_t foo;
6+
7+
A() : foo(5) {}
8+
};

0 commit comments

Comments
 (0)