Generate bindings for inline namespaces
In the bindings, we use fully qualified identifiers everywhere.
In the following example, `C` will always be referred to in the bindings as `A::B::C` regardless of whether the C++ equivalent was `A::B::C`, `A::C` or `C`.
```
namespace A {
inline namespace B {
struct C{};
} // B
} // A
```
So, we don't need any special logic for inline namespaces.
PiperOrigin-RevId: 453906326
diff --git a/rs_bindings_from_cc/src_code_gen.rs b/rs_bindings_from_cc/src_code_gen.rs
index 5012a50..85d6be4 100644
--- a/rs_bindings_from_cc/src_code_gen.rs
+++ b/rs_bindings_from_cc/src_code_gen.rs
@@ -5965,4 +5965,44 @@
);
Ok(())
}
+
+ #[test]
+ fn test_inline_namespace() -> Result<()> {
+ let rs_api = generate_bindings_tokens(&ir_from_cc(
+ r#"
+ namespace test_namespace_bindings {
+ inline namespace inner {
+ struct MyStruct {};
+ }
+ void processMyStruct(MyStruct s);
+ }
+ void processMyStructOutsideNamespace(test_namespace_bindings::inner::MyStruct s);
+ void processMyStructSkipInlineNamespaceQualifier(test_namespace_bindings::MyStruct s);
+ "#,
+ )?)?
+ .rs_api;
+
+ assert_rs_matches!(
+ rs_api,
+ quote! {
+ ...
+ pub mod test_namespace_bindings {
+ ...
+ pub mod inner {
+ ...
+ pub struct MyStruct {...} ...
+ }
+ ...
+ pub fn processMyStruct(s: crate::test_namespace_bindings::inner::MyStruct)
+ ...
+ }
+ ...
+ pub fn processMyStructOutsideNamespace(s: crate::test_namespace_bindings::inner::MyStruct)
+ ...
+ pub fn processMyStructSkipInlineNamespaceQualifier(s: crate::test_namespace_bindings::inner::MyStruct)
+ ...
+ }
+ );
+ Ok(())
+ }
}