Skip to content

Commit

Permalink
Remove vtable method class prefix with --disable-name-namespacing
Browse files Browse the repository at this point in the history
Fix for #2438
  • Loading branch information
Supreeeme committed Jan 19, 2024
1 parent 46c06e5 commit 35ba176
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 2 deletions.
50 changes: 50 additions & 0 deletions bindgen-tests/tests/expectations/tests/disable-namespacing.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions bindgen-tests/tests/expectations/tests/vtable_no_namespacing.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions bindgen-tests/tests/headers/disable-namespacing.hpp
Expand Up @@ -5,5 +5,12 @@ namespace bar {

typedef int Baz;

// anonymous structs should still be "namespaced"
struct Foo {
struct {
int a;
} anon;
};

}
}
5 changes: 5 additions & 0 deletions bindgen-tests/tests/headers/vtable_no_namespacing.hpp
@@ -0,0 +1,5 @@
// bindgen-flags: --disable-name-namespacing

struct Test_Interface {
virtual void Virtual_Method() = 0;
};
1 change: 0 additions & 1 deletion bindgen/codegen/mod.rs
Expand Up @@ -1165,7 +1165,6 @@ impl<'a> CodeGenerator for Vtable<'a> {
_ => panic!("Function signature type mismatch"),
};

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

// FIXME: Need to account for overloading with times_seen (separately from regular function path).
Expand Down
4 changes: 3 additions & 1 deletion bindgen/ir/item.rs
Expand Up @@ -883,7 +883,9 @@ impl Item {
true
});

let ids: Vec<_> = if ctx.options().disable_nested_struct_naming {
let ids: Vec<_> = if ctx.options().disable_nested_struct_naming ||
ctx.options().disable_name_namespacing
{
let mut ids = Vec::new();

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

0 comments on commit 35ba176

Please sign in to comment.