Abort creating wrapper fn for multiple inner fns

This discovers another class of mis-trans where we wrap multiple native functions into a single
wrapper, which is wrong.
This commit is contained in:
Simonas Kazlauskas 2015-02-27 14:18:39 +02:00
parent 2198969f89
commit baa52caf83

View file

@ -642,6 +642,11 @@ pub fn trans_rust_fn_with_foreign_abi<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
// return r;
// }
if llvm::LLVMCountBasicBlocks(llwrapfn) != 0 {
ccx.sess().bug("wrapping a function inside non-empty wrapper, most likely cause is \
multiple functions being wrapped");
}
let ptr = "the block\0".as_ptr();
let the_block = llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), llwrapfn,
ptr as *const _);