Skip to content

Commit 849e4af

Browse files
committed
Remove vtable method class prefix with --disable-name-namespacing
Fix for #2438
1 parent 9f2d2d3 commit 849e4af

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

bindgen-tests/tests/expectations/tests/vtable_no_namespacing.rs

+38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// bindgen-flags: --disable-name-namespacing
2+
struct Interface {
3+
virtual void Method() = 0;
4+
};

bindgen/codegen/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,10 @@ impl<'a> CodeGenerator for Vtable<'a> {
11371137
_ => panic!("Function signature type mismatch"),
11381138
};
11391139

1140-
// FIXME: Is there a canonical name without the class prepended?
1141-
let function_name = function_item.canonical_name(ctx);
1140+
let mut function_name = function_item.canonical_name(ctx);
1141+
if ctx.options().disable_name_namespacing {
1142+
function_name = function_name.rsplit_once('_').unwrap().1.to_string();
1143+
}
11421144

11431145
// FIXME: Need to account for overloading with times_seen (separately from regular function path).
11441146
let function_name = ctx.rust_ident(function_name);

0 commit comments

Comments
 (0)