diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-03-23 02:08:53 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-03-23 02:08:53 +0100 |
commit | 106583a3efc016ce65535bc311c60d2a90499ac5 (patch) | |
tree | 39be41087eb7776792db1512cb60f03f08133fc2 | |
parent | 55dc2f4eb2aeb11231db7e026566eee068e81566 (diff) |
parser: Inherit class typedefs
-rw-r--r-- | src/parser.rs | 9 | ||||
-rw-r--r-- | tests/headers/class_with_typedef.hpp | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 75519a64..02dbd6d2 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -661,7 +661,7 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor, } CXCursor_CXXBaseSpecifier => { let ty = conv_ty(ctx, &cursor.cur_type(), cursor); - let fieldname = if ci.members.len() > 0 { + let fieldname = if !ci.members.is_empty() { format!("_base{}", ci.members.len()) } else { "_base".to_string() @@ -684,6 +684,9 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor, } else { ci.members.push(CompMember::Field(field)); } + if let TComp(ref info) = ty { + ci.typedefs.extend(info.borrow().typedefs.clone().into_iter()); + } ci.base_members += 1; } CXCursor_CXXMethod => { @@ -887,6 +890,10 @@ fn visit_top(cursor: &Cursor, CXChildVisit_Continue } CXCursor_FunctionDecl => { + if ctx.options.ignore_functions { + return CXChildVisit_Continue; + } + let linkage = cursor.linkage(); if linkage != CXLinkage_External && linkage != CXLinkage_UniqueExternal { return CXChildVisit_Continue; diff --git a/tests/headers/class_with_typedef.hpp b/tests/headers/class_with_typedef.hpp index 6055283f..0dbc71ec 100644 --- a/tests/headers/class_with_typedef.hpp +++ b/tests/headers/class_with_typedef.hpp @@ -8,3 +8,8 @@ public: AnotherInt d; AnotherInt* other_ptr; }; + +class D: public C { +public: + MyInt* ptr; +}; |