Skip to content

Commit 1003bd0

Browse files
author
bors-servo
authored
Auto merge of #266 - fitzgen:little-logging-things, r=emilio
Little logging things Little things. See commit messages for details. r? @emilio
2 parents 8f49128 + 60b1c83 commit 1003bd0

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

libbindgen/src/clang.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1235,21 +1235,23 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> String {
12351235
/// Dump the Clang AST to stdout for debugging purposes.
12361236
pub fn ast_dump(c: &Cursor, depth: isize) -> Enum_CXVisitorResult {
12371237
fn print_indent(depth: isize, s: &str) {
1238-
let mut i = 0;
1239-
while i < depth {
1238+
for _ in 0..depth {
12401239
print!("\t");
1241-
i += 1;
12421240
}
12431241
println!("{}", s);
12441242
}
1245-
let ct = c.cur_type().kind();
1243+
12461244
print_indent(depth,
1247-
&format!("({} {} {}",
1245+
&format!("(kind: {}, spelling: {}, type: {}",
12481246
kind_to_str(c.kind()),
12491247
c.spelling(),
1250-
type_to_str(ct)));
1248+
type_to_str(c.cur_type().kind())));
1249+
1250+
// Recurse.
12511251
c.visit(|s| ast_dump(&s, depth + 1));
1252+
12521253
print_indent(depth, ")");
1254+
12531255
CXChildVisit_Continue
12541256
}
12551257

libbindgen/src/codegen/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,12 @@ impl CodeGenerator for Item {
228228
result: &mut CodegenResult,
229229
_extra: &()) {
230230
if self.is_hidden(ctx) || result.seen(self.id()) {
231+
debug!("<Item as CodeGenerator>::codegen: Ignoring hidden or seen: self = {:?}", self);
231232
return;
232233
}
233234

235+
debug!("<Item as CodeGenerator>::codegen: self = {:?}", self);
236+
234237
result.set_seen(self.id());
235238

236239
match *self.kind() {
@@ -264,6 +267,8 @@ impl CodeGenerator for Module {
264267
ctx: &BindgenContext,
265268
result: &mut CodegenResult,
266269
item: &Item) {
270+
debug!("<Module as CodeGenerator>::codegen: item = {:?}", item);
271+
267272
if !ctx.options().enable_cxx_namespaces {
268273
for child in self.children() {
269274
ctx.resolve_item(*child).codegen(ctx, result, &());
@@ -299,6 +304,8 @@ impl CodeGenerator for Var {
299304
ctx: &BindgenContext,
300305
result: &mut CodegenResult,
301306
item: &Item) {
307+
debug!("<Var as CodeGenerator>::codegen: item = {:?}", item);
308+
302309
let canonical_name = item.canonical_name(ctx);
303310

304311
if result.seen_var(&canonical_name) {
@@ -349,6 +356,8 @@ impl CodeGenerator for Type {
349356
ctx: &BindgenContext,
350357
result: &mut CodegenResult,
351358
item: &Item) {
359+
debug!("<Type as CodeGenerator>::codegen: item = {:?}", item);
360+
352361
match *self.kind() {
353362
TypeKind::Void |
354363
TypeKind::NullPtr |
@@ -600,6 +609,9 @@ impl CodeGenerator for CompInfo {
600609
result: &mut CodegenResult,
601610
item: &Item) {
602611
use aster::struct_field::StructFieldBuilder;
612+
613+
debug!("<CompInfo as CodeGenerator>::codegen: item = {:?}", item);
614+
603615
// Don't output classes with template parameters that aren't types, and
604616
// also don't output template specializations, neither total or partial.
605617
//
@@ -1361,6 +1373,8 @@ impl CodeGenerator for Enum {
13611373
ctx: &BindgenContext,
13621374
result: &mut CodegenResult,
13631375
item: &Item) {
1376+
debug!("<Enum as CodeGenerator>::codegen: item = {:?}", item);
1377+
13641378
let name = item.canonical_name(ctx);
13651379
let enum_ty = item.expect_type();
13661380
let layout = enum_ty.layout(ctx);
@@ -1800,6 +1814,8 @@ impl CodeGenerator for Function {
18001814
ctx: &BindgenContext,
18011815
result: &mut CodegenResult,
18021816
item: &Item) {
1817+
debug!("<Function as CodeGenerator>::codegen: item = {:?}", item);
1818+
18031819
let name = self.name();
18041820
let mut canonical_name = item.canonical_name(ctx);
18051821
let mangled_name = self.mangled_name();

0 commit comments

Comments
 (0)