diff options
Diffstat (limited to 'src/ir/comp.rs')
-rw-r--r-- | src/ir/comp.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs index b02cd342..7c58e233 100644 --- a/src/ir/comp.rs +++ b/src/ir/comp.rs @@ -669,11 +669,20 @@ impl CompInfo { CXCursor_UnionDecl | CXCursor_ClassTemplate | CXCursor_ClassDecl => { + // We can find non-semantic children here, clang uses a + // StructDecl to note incomplete structs that hasn't been + // forward-declared before, see: + // + // https://github.com/servo/rust-bindgen/issues/482 + if cur.semantic_parent() != cursor { + return CXChildVisit_Continue; + } + let inner = Item::parse(cur, Some(potential_id), ctx) .expect("Inner ClassDecl"); - if !ci.inner_types.contains(&inner) { - ci.inner_types.push(inner); - } + + ci.inner_types.push(inner); + // A declaration of an union or a struct without name could // also be an unnamed field, unfortunately. if cur.spelling().is_empty() && |