pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
unsafe {
let len = s.get().len();
- let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s, false), Type::i8p(cx).to_ref());
+ let cs = llvm::LLVMConstPointerCast(C_cstr(cx, s, false),
+ Type::i8p(cx).to_ref());
C_struct(cx, [cs, C_uint(cx, len)], false)
}
}
param_bounds.get(n_bound).clone()
}
-pub fn filename_and_line_num_from_span(bcx: &Block, span: Span)
- -> (ValueRef, ValueRef) {
- let loc = bcx.sess().codemap().lookup_char_pos(span.lo);
- let filename_cstr = C_cstr(bcx.ccx(),
- token::intern_and_get_ident(loc.file
- .name
- .as_slice()),
- true);
- let filename = build::PointerCast(bcx, filename_cstr, Type::i8p(bcx.ccx()));
- let line = C_int(bcx.ccx(), loc.line as int);
- (filename, line)
-}
-
// Casts a Rust bool value to an i1.
pub fn bool_to_i1(bcx: &Block, llval: ValueRef) -> ValueRef {
build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(bcx.ccx(), false))