Skip to content

Commit 107b7b9

Browse files
author
bors-servo
authored
Auto merge of #694 - emilio:finally, r=fitzgen
ir: Handle default template parameters in libclang >3.9. Fixes #585
2 parents 18b7e62 + 17d00de commit 107b7b9

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/ir/template.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,22 @@ impl TemplateInstantiation {
233233

234234
let template_args = ty.template_args()
235235
.map_or(vec![], |args| {
236-
args.filter(|t| t.kind() != CXType_Invalid)
237-
.map(|t| {
238-
Item::from_ty_or_ref(t, t.declaration(), None, ctx)
239-
})
240-
.collect()
236+
match ty.canonical_type().template_args() {
237+
Some(canonical_args) => {
238+
let arg_count = args.len();
239+
args.chain(canonical_args.skip(arg_count))
240+
.filter(|t| t.kind() != CXType_Invalid)
241+
.map(|t| {
242+
Item::from_ty_or_ref(t, t.declaration(), None, ctx)
243+
}).collect()
244+
}
245+
None => {
246+
args.filter(|t| t.kind() != CXType_Invalid)
247+
.map(|t| {
248+
Item::from_ty_or_ref(t, t.declaration(), None, ctx)
249+
}).collect()
250+
}
251+
}
241252
});
242253

243254
let definition = ty.declaration()

0 commit comments

Comments
 (0)