Skip to content

Commit 7a24b1d

Browse files
committed
Remove vtable method class prefix with --disable-name-namespacing
Fix for #2438
1 parent 46c06e5 commit 7a24b1d

File tree

6 files changed

+96
-2
lines changed

6 files changed

+96
-2
lines changed

bindgen-tests/tests/expectations/tests/disable-namespacing.rs

+50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/headers/disable-namespacing.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ namespace bar {
55

66
typedef int Baz;
77

8+
// anonymous structs should still be "namespaced"
9+
struct Foo {
10+
struct {
11+
int a;
12+
} anon;
13+
};
14+
815
}
916
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// bindgen-flags: --disable-name-namespacing
2+
3+
struct Test_Interface {
4+
virtual void Virtual_Method() = 0;
5+
};

bindgen/codegen/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,6 @@ impl<'a> CodeGenerator for Vtable<'a> {
11651165
_ => panic!("Function signature type mismatch"),
11661166
};
11671167

1168-
// FIXME: Is there a canonical name without the class prepended?
11691168
let function_name = function_item.canonical_name(ctx);
11701169

11711170
// FIXME: Need to account for overloading with times_seen (separately from regular function path).

bindgen/ir/item.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,8 @@ impl Item {
883883
true
884884
});
885885

886-
let ids: Vec<_> = if ctx.options().disable_nested_struct_naming {
886+
let ids: Vec<_> = if ctx.options().disable_nested_struct_naming
887+
|| ctx.options().disable_name_namespacing {
887888
let mut ids = Vec::new();
888889

889890
// If target is anonymous we need find its first named ancestor.

0 commit comments

Comments
 (0)