Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vtable method class prefix with --disable-name-namespacing #2451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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