summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-08-23 16:52:50 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-09-04 12:08:57 +0200
commitbf9b3e9c31b2f02796b38ec4472e4b32a6978e6c (patch)
treecb53b7453f6d4f0c5a8c5b691dcf3bed43fff2f5 /src
parent28de37efc4d265ef6a15468e95b2bc3aa8a76ec3 (diff)
ir: When something has a definition, return unresolved type references until we parse it.
This ensures that we see all the relevant types that are defined when parsing the definition, avoiding problems like #888. Fixes #888
Diffstat (limited to 'src')
-rw-r--r--src/ir/item.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ir/item.rs b/src/ir/item.rs
index b6fe6d43..e3c5d4a7 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -1194,7 +1194,18 @@ impl ClangItemParser for Item {
// Types are sort of special, so to avoid parsing template classes
// twice, handle them separately.
{
- let applicable_cursor = cursor.definition().unwrap_or(cursor);
+ let definition = cursor.definition();
+ let applicable_cursor = definition.unwrap_or(cursor);
+
+ if definition.is_some() && definition != Some(cursor) {
+ return Ok(Item::from_ty_or_ref(
+ applicable_cursor.cur_type(),
+ cursor,
+ parent_id,
+ ctx,
+ ));
+ }
+
match Item::from_ty(
&applicable_cursor.cur_type(),
applicable_cursor,