Skip to content

Commit 0ec5a6a

Browse files
committed
codegen: Properly mangle method names.
1 parent 5976766 commit 0ec5a6a

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

libbindgen/src/codegen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ impl MethodCodegen for Method {
14041404

14051405
let item = ast::ImplItem {
14061406
id: ast::DUMMY_NODE_ID,
1407-
ident: ctx.ext_cx().ident_of(&name),
1407+
ident: ctx.rust_ident(&name),
14081408
vis: ast::Visibility::Public,
14091409
attrs: attrs,
14101410
node: ast::ImplItemKind::Method(sig, P(block)),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
#[test]
13+
fn bindgen_test_layout_Foo() {
14+
assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
15+
assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
16+
}
17+
extern "C" {
18+
#[link_name = "_ZN3Foo4typeEv"]
19+
pub fn Foo_type(this: *mut Foo) -> ::std::os::raw::c_int;
20+
}
21+
impl Clone for Foo {
22+
fn clone(&self) -> Self { *self }
23+
}
24+
impl Foo {
25+
#[inline]
26+
pub unsafe fn type_(&mut self) -> ::std::os::raw::c_int {
27+
Foo_type(&mut *self)
28+
}
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
class Foo {
3+
public:
4+
int type();
5+
};

0 commit comments

Comments
 (0)