Add unsafe tags to usage of LLVM funcs

This commit is contained in:
Niko Matsakis 2011-10-07 10:59:19 -07:00 committed by Brian Anderson
parent 8ea1a8eef9
commit c1cefa52d0

View File

@ -428,11 +428,13 @@ fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); }
// Returns the nth element of the given LLVM structure type.
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef {
let elt_count = llvm::LLVMCountStructElementTypes(llstructty);
assert (n < elt_count);
let elt_tys = std::vec::init_elt(T_nil(), elt_count);
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
ret llvm::LLVMGetElementType(elt_tys[n]);
unsafe {
let elt_count = llvm::LLVMCountStructElementTypes(llstructty);
assert (n < elt_count);
let elt_tys = std::vec::init_elt(T_nil(), elt_count);
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
ret llvm::LLVMGetElementType(elt_tys[n]);
}
}
fn find_scope_cx(cx: @block_ctxt) -> @block_ctxt {