Skip to content

Commit 3289e93

Browse files
author
bors-servo
authored
Auto merge of #344 - emilio:fix-dtors, r=fitzgen
Properly mangle method names, don't generate destructors. r? @fitzgen Fixes a few issues seen in #342
2 parents 59a5256 + 31bd2d3 commit 3289e93

File tree

6 files changed

+67
-2
lines changed

6 files changed

+67
-2
lines changed

libbindgen/src/codegen/mod.rs

+1-1
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)),

libbindgen/src/ir/function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ impl ClangSubItemParser for Function {
242242
-> Result<ParseResult<Self>, ParseError> {
243243
use clang_sys::*;
244244
match cursor.kind() {
245+
// FIXME(emilio): Generate destructors properly.
245246
CXCursor_FunctionDecl |
246247
CXCursor_Constructor |
247-
CXCursor_Destructor |
248248
CXCursor_CXXMethod => {}
249249
_ => return Err(ParseError::Continue),
250250
};
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
#[repr(C)]
8+
#[derive(Debug)]
9+
pub struct cv_String {
10+
pub _address: u8,
11+
}
12+
#[test]
13+
fn bindgen_test_layout_cv_String() {
14+
assert_eq!(::std::mem::size_of::<cv_String>() , 1usize);
15+
assert_eq!(::std::mem::align_of::<cv_String>() , 1usize);
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
class Foo {
3+
public:
4+
int type();
5+
};
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
3+
namespace cv {
4+
class String {
5+
public:
6+
~String();
7+
};
8+
9+
10+
inline
11+
String::~String()
12+
{
13+
}
14+
15+
}

0 commit comments

Comments
 (0)