From 0063bf31566971c61d5d1d743fcb946057318776 Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Sat, 18 Feb 2017 20:02:07 +0100 Subject: comp: parse definitions even when they aren't in the correct scope. --- src/ir/comp.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ir/comp.rs b/src/ir/comp.rs index ce6ec25d..a4929b7a 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -625,8 +625,15 @@ impl CompInfo { // StructDecl to note incomplete structs that hasn't been // forward-declared before, see: // + // Also, clang seems to scope struct definitions inside + // unions to the whole translation unit. Since those are + // anonymous, let's just assume that if the cursor we've + // found is a definition it's a valid inner type. + // // https://github.com/servo/rust-bindgen/issues/482 - if cur.semantic_parent() != cursor { + let is_inner_struct = cur.semantic_parent() == cursor || + cur.is_definition(); + if !is_inner_struct { return CXChildVisit_Continue; } -- cgit v1.2.3