summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-02-18 20:02:07 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-02-19 10:54:04 +0100
commit0063bf31566971c61d5d1d743fcb946057318776 (patch)
tree7d1eb019e98acf5c9d765846f09599a431961af2
parentdd9f25e670d39917118a4ae60897c2d4365e471f (diff)
comp: parse definitions even when they aren't in the correct scope.
-rw-r--r--src/ir/comp.rs9
1 files changed, 8 insertions, 1 deletions
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;
}