From d3cfcf66e4306ef209fefb8c079a725cb7dce90e Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Mon, 4 Apr 2016 17:49:38 +0200 Subject: parser: Honour annotations on typedefs and fully on type declarations. --- src/parser.rs | 8 ++++++++ tests/headers/annotation_hide.hpp | 5 +++++ tests/headers/class_nested.hpp | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 tests/headers/annotation_hide.hpp 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 @@ + +/** + *
+ */ +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; +}; -- cgit v1.2.3