Skip to content

Commit

Permalink
Abort creating wrapper fn for multiple inner fns
Browse files Browse the repository at this point in the history
This discovers another class of mis-trans where we wrap multiple native functions into a single
wrapper, which is wrong.
  • Loading branch information
nagisa committed Apr 3, 2015
1 parent 2198969 commit baa52ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_trans/trans/foreign.rs
Expand Up @@ -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 _);
Expand Down

0 comments on commit baa52ca

Please sign in to comment.