Skip to content

Commit

Permalink
Simpliy block creation in MirContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jan 4, 2017
1 parent 37dd9f6 commit 4c9995a
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/librustc_trans/mir/mod.rs
Expand Up @@ -31,7 +31,6 @@ use syntax::symbol::keywords;
use syntax::abi::Abi;

use std::iter;
use std::ffi::CString;

use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
Expand Down Expand Up @@ -218,17 +217,10 @@ pub fn trans_mir<'a, 'tcx: 'a>(
// Allocate a `Block` for every basic block
let block_bcxs: IndexVec<mir::BasicBlock, BasicBlockRef> =
mir.basic_blocks().indices().map(|bb| {
let name = if bb == mir::START_BLOCK {
CString::new("start").unwrap()
if bb == mir::START_BLOCK {
bcx.build_new_block("start").llbb()
} else {
CString::new(format!("{:?}", bb)).unwrap()
};
unsafe {
llvm::LLVMAppendBasicBlockInContext(
ccx.llcx(),
llfn,
name.as_ptr()
)
bcx.build_new_block(&format!("{:?}", bb)).llbb()
}
}).collect();

Expand Down

0 comments on commit 4c9995a

Please sign in to comment.