fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
           ty: Type, output: ty::t) -> ValueRef {
    let llfn: ValueRef = name.with_c_str(|buf| {
        unsafe {
            llvm::LLVMGetOrInsertFunction(llmod, buf, ty.to_ref())
        }
    });

    match ty::get(output).sty {
        // functions returning bottom may unwind, but can never return normally
        ty::ty_bot => {
            unsafe {
                llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
            }
        }
        // `~` pointer return values never alias because ownership is transferred
        // FIXME #6750 ~Trait cannot be directly marked as
        // noalias because the actual object pointer is nested.
        ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
        ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) => {
            unsafe {
                llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
            }
        }
        _ => {}
    }

    lib::llvm::SetFunctionCallConv(llfn, cc);
    // Function addresses in Rust are never significant, allowing functions to be merged.
    lib::llvm::SetUnnamedAddr(llfn, true);

    llfn
}
// only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
only use this for foreign function ABIs and glue use ` decl_rust_fn ` for Rust functions
fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
           ty: Type, output: ty::t) -> ValueRef {
    let llfn: ValueRef = name.with_c_str(|buf| {
        unsafe {
            llvm::LLVMGetOrInsertFunction(llmod, buf, ty.to_ref())
        }
    });
    match ty::get(output).sty {
        // functions returning bottom may unwind, but can never return normally
        ty::ty_bot => {
            unsafe {
                llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
            }
        }
        // `~` pointer return values never alias because ownership is transferred
        // FIXME #6750 ~Trait cannot be directly marked as
        // noalias because the actual object pointer is nested.
        ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
        ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) => {
            unsafe {
                llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
            }
        }
        _ => {}
    }
    lib::llvm::SetFunctionCallConv(llfn, cc);
    // Function addresses in Rust are never significant, allowing functions to be merged.
    lib::llvm::SetUnnamedAddr(llfn, true);
    llfn
}
fn decl_fn ( llmod : ModuleRef , name : & str , cc : lib :: llvm :: CallConv , ty : Type , output : ty :: t ) -> ValueRef { let llfn : ValueRef = name . with_c_str ( | buf | { unsafe { llvm :: LLVMGetOrInsertFunction ( llmod , buf , ty . to_ref ( ) ) } } ) ; match ty :: get ( output ) . sty { // functions returning bottom may unwind, but can never return normally ty :: ty_bot => { unsafe { llvm :: LLVMAddFunctionAttr ( llfn , lib :: llvm :: NoReturnAttribute as c_uint ) } } // `~` pointer return values never alias because ownership is transferred // FIXME #6750 ~Trait cannot be directly marked as // noalias because the actual object pointer is nested. ty :: ty_uniq ( .. ) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) | ty :: ty_vec ( _ , ty :: vstore_uniq ) | ty :: ty_str ( ty :: vstore_uniq ) => { unsafe { llvm :: LLVMAddReturnAttribute ( llfn , lib :: llvm :: NoAliasAttribute as c_uint ) ; } } _ => { } } lib :: llvm :: SetFunctionCallConv ( llfn , cc ) ; // Function addresses in Rust are never significant, allowing functions to be merged. lib :: llvm :: SetUnnamedAddr ( llfn , true ) ; llfn }
only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
only use this for foreign function ABIs and glue use ` decl_rust_fn ` for Rust functions
llmod
ModuleRef
name
&str
cc
lib::llvm::CallConv
ty
Type
output
ty::t
llmod
ModuleRef
name
&str
cc
lib::llvm::CallConv
ty
Type
output
ty::t