Skip to content

Commit d4fce37

Browse files
author
bors-servo
authored
Auto merge of #604 - tsliang:master, r=fitzgen
This should resolve #571. As discussed with @fitzgen I have moved the builtin-filtering out of `ast_dump` itself; this logic now happens at the point of call in `src/lib.rs`
2 parents d2af109 + cd23273 commit d4fce37

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/clang.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1482,9 +1482,6 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
14821482
}
14831483

14841484
fn print_cursor<S: AsRef<str>>(depth: isize, prefix: S, c: &Cursor) {
1485-
if c.is_builtin() {
1486-
return;
1487-
}
14881485
let prefix = prefix.as_ref();
14891486
print_indent(depth,
14901487
format!(" {}kind = {}", prefix, kind_to_str(c.kind())));

src/lib.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,17 @@ fn parse(context: &mut BindgenContext) -> Result<(), ()> {
896896
}
897897

898898
let cursor = context.translation_unit().cursor();
899+
899900
if context.options().emit_ast {
900-
cursor.visit(|cur| clang::ast_dump(&cur, 0));
901+
902+
fn dump_if_not_builtin(cur: &clang::Cursor) -> CXChildVisitResult {
903+
if !cur.is_builtin() {
904+
clang::ast_dump(&cur, 0)
905+
} else {
906+
CXChildVisit_Continue
907+
}
908+
}
909+
cursor.visit(|cur| dump_if_not_builtin(&cur));
901910
}
902911

903912
let root = context.root_module();

0 commit comments

Comments
 (0)