diff options
author | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-04-04 17:49:38 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <me@emiliocobos.me> | 2016-04-04 17:49:38 +0200 |
commit | d3cfcf66e4306ef209fefb8c079a725cb7dce90e (patch) | |
tree | a36ba4fcaa8c1acfdfbd196e97e2a3f8d764d004 | |
parent | e36138ea6733f882dd1d95992aaee307ff0cc69c (diff) |
parser: Honour annotations on typedefs and fully on type declarations.
-rw-r--r-- | src/parser.rs | 8 | ||||
-rw-r--r-- | tests/headers/annotation_hide.hpp | 5 | ||||
-rw-r--r-- | tests/headers/class_nested.hpp | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/parser.rs b/src/parser.rs index dc4b6e06..e6e60bab 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -861,6 +861,9 @@ fn visit_top(cursor: &Cursor, | CXCursor_ClassDecl | CXCursor_ClassTemplate => { let anno = Annotations::new(cursor); + if anno.hide { + return CXChildVisit_Continue; + } fwd_decl(ctx, cursor, move |ctx_| { let decl = decl_name(ctx_, cursor); let ci = decl.compinfo(); @@ -951,6 +954,11 @@ fn visit_top(cursor: &Cursor, CXChildVisit_Continue } CXCursor_TypedefDecl => { + let anno = Annotations::new(cursor); + if anno.hide { + return CXChildVisit_Continue; + } + let mut under_ty = cursor.typedef_type(); if under_ty.kind() == CXType_Unexposed { under_ty = under_ty.canonical_type(); diff --git a/tests/headers/annotation_hide.hpp b/tests/headers/annotation_hide.hpp new file mode 100644 index 00000000..33bfb353 --- /dev/null +++ b/tests/headers/annotation_hide.hpp @@ -0,0 +1,5 @@ + +/** + * <div rustbindgen="true" hide="true"></div> + */ +struct C; diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp index e9c07d64..05a775b8 100644 --- a/tests/headers/class_nested.hpp +++ b/tests/headers/class_nested.hpp @@ -1,7 +1,13 @@ class A { +public: int member_a; class B { int member_b; }; }; +A::B var; + +class D { + A::B member; +}; |