summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-03-31 16:09:58 -0500
committerGitHub <noreply@github.com>2017-03-31 16:09:58 -0500
commitd4fce37939fbcebd04e7b7efec6930cfd717b13d (patch)
tree110e47bf2143c7e19b2a23b7ad43e9f4dd81a242 /src
parentd2af109f70583144a393132cd5ea4159752176eb (diff)
parentcd232734766d165981671c42d9b21b0dd4ae20cc (diff)
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`
Diffstat (limited to 'src')
-rw-r--r--src/clang.rs3
-rw-r--r--src/lib.rs11
2 files changed, 10 insertions, 4 deletions
diff --git a/src/clang.rs b/src/clang.rs
index 2dbe5e51..b4acf204 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -1482,9 +1482,6 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
}
fn print_cursor<S: AsRef<str>>(depth: isize, prefix: S, c: &Cursor) {
- if c.is_builtin() {
- return;
- }
let prefix = prefix.as_ref();
print_indent(depth,
format!(" {}kind = {}", prefix, kind_to_str(c.kind())));
diff --git a/src/lib.rs b/src/lib.rs
index 8f838c15..eccf80e3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -896,8 +896,17 @@ fn parse(context: &mut BindgenContext) -> Result<(), ()> {
}
let cursor = context.translation_unit().cursor();
+
if context.options().emit_ast {
- cursor.visit(|cur| clang::ast_dump(&cur, 0));
+
+ fn dump_if_not_builtin(cur: &clang::Cursor) -> CXChildVisitResult {
+ if !cur.is_builtin() {
+ clang::ast_dump(&cur, 0)
+ } else {
+ CXChildVisit_Continue
+ }
+ }
+ cursor.visit(|cur| dump_if_not_builtin(&cur));
}
let root = context.root_module();