Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,6 @@ impl CodeGenerator for Vtable<'_> {
let signature_item = ctx.resolve_item(function.signature());
let TypeKind::Function(ref signature) = signature_item.expect_type().kind() else { 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
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,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
Loading