diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-07 02:30:51 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-01-11 14:34:24 +0100 |
commit | 8c54a566457a1c4aacabf72977380c25c7fa10a1 (patch) | |
tree | abd6b1a5349937bdafebf35c2cf90f54c8fae7c6 /libbindgen/tests | |
parent | 66447ff277181073d14bb04c7947eec805cd0623 (diff) |
ir: Handle inline namespaces.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
Diffstat (limited to 'libbindgen/tests')
6 files changed, 106 insertions, 0 deletions
diff --git a/libbindgen/tests/expectations/tests/inline_namespace.rs b/libbindgen/tests/expectations/tests/inline_namespace.rs new file mode 100644 index 00000000..5f6776b7 --- /dev/null +++ b/libbindgen/tests/expectations/tests/inline_namespace.rs @@ -0,0 +1,28 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod foo { + #[allow(unused_imports)] + use self::super::super::root; + pub type Ty = ::std::os::raw::c_int; + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Bar { + pub baz: root::foo::Ty, + } + #[test] + fn bindgen_test_layout_Bar() { + assert_eq!(::std::mem::size_of::<Bar>() , 4usize); + assert_eq!(::std::mem::align_of::<Bar>() , 4usize); + } + impl Clone for Bar { + fn clone(&self) -> Self { *self } + } +} diff --git a/libbindgen/tests/expectations/tests/inline_namespace_conservative.rs b/libbindgen/tests/expectations/tests/inline_namespace_conservative.rs new file mode 100644 index 00000000..d759a882 --- /dev/null +++ b/libbindgen/tests/expectations/tests/inline_namespace_conservative.rs @@ -0,0 +1,33 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod foo { + #[allow(unused_imports)] + use self::super::super::root; + pub mod bar { + #[allow(unused_imports)] + use self::super::super::super::root; + pub type Ty = ::std::os::raw::c_int; + } + pub type Ty = ::std::os::raw::c_longlong; + } + #[repr(C)] + #[derive(Debug, Copy)] + pub struct Bar { + pub baz: root::foo::bar::Ty, + } + #[test] + fn bindgen_test_layout_Bar() { + assert_eq!(::std::mem::size_of::<Bar>() , 4usize); + assert_eq!(::std::mem::align_of::<Bar>() , 4usize); + } + impl Clone for Bar { + fn clone(&self) -> Self { *self } + } +} diff --git a/libbindgen/tests/expectations/tests/inline_namespace_whitelist.rs b/libbindgen/tests/expectations/tests/inline_namespace_whitelist.rs new file mode 100644 index 00000000..9b8f87a5 --- /dev/null +++ b/libbindgen/tests/expectations/tests/inline_namespace_whitelist.rs @@ -0,0 +1,15 @@ +/* automatically generated by rust-bindgen */ + + +#![allow(non_snake_case)] + + +pub mod root { + #[allow(unused_imports)] + use self::super::root; + pub mod std { + #[allow(unused_imports)] + use self::super::super::root; + pub type string = *const ::std::os::raw::c_char; + } +} diff --git a/libbindgen/tests/headers/inline_namespace.hpp b/libbindgen/tests/headers/inline_namespace.hpp new file mode 100644 index 00000000..2ccf8ab0 --- /dev/null +++ b/libbindgen/tests/headers/inline_namespace.hpp @@ -0,0 +1,11 @@ +// bindgen-flags: --enable-cxx-namespaces -- -std=c++11 + +namespace foo { + inline namespace bar { + using Ty = int; + }; +}; + +class Bar { + foo::Ty baz; +}; diff --git a/libbindgen/tests/headers/inline_namespace_conservative.hpp b/libbindgen/tests/headers/inline_namespace_conservative.hpp new file mode 100644 index 00000000..50068a2e --- /dev/null +++ b/libbindgen/tests/headers/inline_namespace_conservative.hpp @@ -0,0 +1,12 @@ +// bindgen-flags: --enable-cxx-namespaces --conservative-inline-namespaces -- -std=c++11 + +namespace foo { + inline namespace bar { + using Ty = int; + }; + using Ty = long long; +}; + +class Bar { + foo::bar::Ty baz; +}; diff --git a/libbindgen/tests/headers/inline_namespace_whitelist.hpp b/libbindgen/tests/headers/inline_namespace_whitelist.hpp new file mode 100644 index 00000000..30047bbe --- /dev/null +++ b/libbindgen/tests/headers/inline_namespace_whitelist.hpp @@ -0,0 +1,7 @@ +// bindgen-flags: --enable-cxx-namespaces --whitelist-type=std::string -- -std=c++11 + +namespace std { + inline namespace bar { + using string = const char*; + }; +}; |