summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen/mod.rs4
-rw-r--r--src/ir/function.rs10
2 files changed, 6 insertions, 8 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 17738426..449cfa03 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2869,7 +2869,7 @@ impl TryToRustTy for FunctionSig {
let fnty = ast::TyKind::BareFn(P(ast::BareFnTy {
unsafety: ast::Unsafety::Unsafe,
- abi: self.abi().expect("Invalid abi for function!"),
+ abi: self.abi().expect("Invalid or unknown ABI for function!"),
lifetimes: vec![],
decl: decl,
}));
@@ -2950,7 +2950,7 @@ impl CodeGenerator for Function {
};
let item = ForeignModBuilder::new(signature.abi()
- .expect("Invalid abi for function!"))
+ .expect("Invalid or unknown ABI for function!"))
.with_foreign_item(foreign_item)
.build(ctx);
diff --git a/src/ir/function.rs b/src/ir/function.rs
index dcb39fc1..10a791d8 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -105,8 +105,7 @@ fn get_abi(cc: CXCallingConv) -> Option<abi::Abi> {
CXCallingConv_X86FastCall => Some(abi::Abi::Fastcall),
CXCallingConv_AAPCS => Some(abi::Abi::Aapcs),
CXCallingConv_X86_64Win64 => Some(abi::Abi::Win64),
- CXCallingConv_Invalid => None,
- other => panic!("unsupported calling convention: {:?}", other),
+ _ => None,
}
}
@@ -297,12 +296,11 @@ impl FunctionSig {
try!(ty.ret_type().ok_or(ParseError::Continue))
};
let ret = Item::from_ty_or_ref(ty_ret_type, cursor, None, ctx);
- let abi = get_abi(ty.call_conv());
+ let call_conv = ty.call_conv();
+ let abi = get_abi(call_conv);
if abi.is_none() {
- assert!(cursor.kind() == CXCursor_ObjCInstanceMethodDecl ||
- cursor.kind() == CXCursor_ObjCClassMethodDecl,
- "Invalid ABI for function signature")
+ warn!("Unknown calling convention: {:?}", call_conv);
}
Ok(Self::new(ret, args, ty.is_variadic(), abi))