Skip to content

Commit 0063bf3

Browse files
committed
comp: parse definitions even when they aren't in the correct scope.
1 parent dd9f25e commit 0063bf3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ir/comp.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,15 @@ impl CompInfo {
625625
// StructDecl to note incomplete structs that hasn't been
626626
// forward-declared before, see:
627627
//
628+
// Also, clang seems to scope struct definitions inside
629+
// unions to the whole translation unit. Since those are
630+
// anonymous, let's just assume that if the cursor we've
631+
// found is a definition it's a valid inner type.
632+
//
628633
// https://github.com/servo/rust-bindgen/issues/482
629-
if cur.semantic_parent() != cursor {
634+
let is_inner_struct = cur.semantic_parent() == cursor ||
635+
cur.is_definition();
636+
if !is_inner_struct {
630637
return CXChildVisit_Continue;
631638
}
632639

0 commit comments

Comments
 (0)