summaryrefslogtreecommitdiff
path: root/libbindgen/src
diff options
context:
space:
mode:
Diffstat (limited to 'libbindgen/src')
-rw-r--r--libbindgen/src/clang.rs14
-rw-r--r--libbindgen/src/codegen/mod.rs16
2 files changed, 24 insertions, 6 deletions
diff --git a/libbindgen/src/clang.rs b/libbindgen/src/clang.rs
index 7da755ea..d10457b3 100644
--- a/libbindgen/src/clang.rs
+++ b/libbindgen/src/clang.rs
@@ -1235,21 +1235,23 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> String {
/// Dump the Clang AST to stdout for debugging purposes.
pub fn ast_dump(c: &Cursor, depth: isize) -> Enum_CXVisitorResult {
fn print_indent(depth: isize, s: &str) {
- let mut i = 0;
- while i < depth {
+ for _ in 0..depth {
print!("\t");
- i += 1;
}
println!("{}", s);
}
- let ct = c.cur_type().kind();
+
print_indent(depth,
- &format!("({} {} {}",
+ &format!("(kind: {}, spelling: {}, type: {}",
kind_to_str(c.kind()),
c.spelling(),
- type_to_str(ct)));
+ type_to_str(c.cur_type().kind())));
+
+ // Recurse.
c.visit(|s| ast_dump(&s, depth + 1));
+
print_indent(depth, ")");
+
CXChildVisit_Continue
}
diff --git a/libbindgen/src/codegen/mod.rs b/libbindgen/src/codegen/mod.rs
index 009d8819..99ec56f4 100644
--- a/libbindgen/src/codegen/mod.rs
+++ b/libbindgen/src/codegen/mod.rs
@@ -228,9 +228,12 @@ impl CodeGenerator for Item {
result: &mut CodegenResult,
_extra: &()) {
if self.is_hidden(ctx) || result.seen(self.id()) {
+ debug!("<Item as CodeGenerator>::codegen: Ignoring hidden or seen: self = {:?}", self);
return;
}
+ debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
+
result.set_seen(self.id());
match *self.kind() {
@@ -264,6 +267,8 @@ impl CodeGenerator for Module {
ctx: &BindgenContext,
result: &mut CodegenResult,
item: &Item) {
+ debug!("<Module as CodeGenerator>::codegen: item = {:?}", item);
+
if !ctx.options().enable_cxx_namespaces {
for child in self.children() {
ctx.resolve_item(*child).codegen(ctx, result, &());
@@ -299,6 +304,8 @@ impl CodeGenerator for Var {
ctx: &BindgenContext,
result: &mut CodegenResult,
item: &Item) {
+ debug!("<Var as CodeGenerator>::codegen: item = {:?}", item);
+
let canonical_name = item.canonical_name(ctx);
if result.seen_var(&canonical_name) {
@@ -349,6 +356,8 @@ impl CodeGenerator for Type {
ctx: &BindgenContext,
result: &mut CodegenResult,
item: &Item) {
+ debug!("<Type as CodeGenerator>::codegen: item = {:?}", item);
+
match *self.kind() {
TypeKind::Void |
TypeKind::NullPtr |
@@ -600,6 +609,9 @@ impl CodeGenerator for CompInfo {
result: &mut CodegenResult,
item: &Item) {
use aster::struct_field::StructFieldBuilder;
+
+ debug!("<CompInfo as CodeGenerator>::codegen: item = {:?}", item);
+
// Don't output classes with template parameters that aren't types, and
// also don't output template specializations, neither total or partial.
//
@@ -1361,6 +1373,8 @@ impl CodeGenerator for Enum {
ctx: &BindgenContext,
result: &mut CodegenResult,
item: &Item) {
+ debug!("<Enum as CodeGenerator>::codegen: item = {:?}", item);
+
let name = item.canonical_name(ctx);
let enum_ty = item.expect_type();
let layout = enum_ty.layout(ctx);
@@ -1800,6 +1814,8 @@ impl CodeGenerator for Function {
ctx: &BindgenContext,
result: &mut CodegenResult,
item: &Item) {
+ debug!("<Function as CodeGenerator>::codegen: item = {:?}", item);
+
let name = self.name();
let mut canonical_name = item.canonical_name(ctx);
let mangled_name = self.mangled_name();