summaryrefslogtreecommitdiff
path: root/src/ir/function.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/function.rs')
-rw-r--r--src/ir/function.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index f7f4398b..3f2c8254 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -442,7 +442,16 @@ impl FunctionSig {
ty.ret_type().ok_or(ParseError::Continue)?
};
let ret = Item::from_ty_or_ref(ty_ret_type, cursor, None, ctx);
- let call_conv = ty.call_conv();
+
+ // Clang plays with us at "find the calling convention", see #549 and
+ // co. This seems to be a better fix than that commit.
+ let mut call_conv = ty.call_conv();
+ if let Some(ty) = cursor.cur_type().canonical_type().pointee_type() {
+ let cursor_call_conv = ty.call_conv();
+ if cursor_call_conv != CXCallingConv_Invalid {
+ call_conv = cursor_call_conv;
+ }
+ }
let abi = get_abi(call_conv);
if abi.is_unknown() {