diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-09-26 12:26:38 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-09-26 12:33:50 +0200 |
commit | c75b62d1a19b79a053996642f4915269e38f877c (patch) | |
tree | 4a4dcb262f29838cc6d20c396ddf0ae6880ac265 /src/ir/function.rs | |
parent | 4a3eec8c4f996b78a1f7ae4ff8fee06bebd963b6 (diff) |
A better fix for the calling convention madness.
Seems like a better fix, which allows us to preserve typedefs properly, and
also to find the calling convention.
Fixes #1402.
Diffstat (limited to 'src/ir/function.rs')
-rw-r--r-- | src/ir/function.rs | 11 |
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() { |