Skip to content

Commit dd7fece

Browse files
committed
---
yaml --- r: 89940 b: refs/heads/master c: 5b534e4 h: refs/heads/master v: v3
1 parent a885e94 commit dd7fece

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 50fb4be1cce008ef8c0b4b40e70460c1be1d795a
2+
refs/heads/master: 5b534e4a22d914e284c650f4504789c2678961bd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/middle/trans/foreign.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,19 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
399399

400400
let tys = foreign_types_for_id(ccx, node_id);
401401
let llfn_ty = lltype_for_fn_from_foreign_types(&tys);
402+
let t = ty::node_id_to_type(ccx.tcx, node_id);
403+
let cconv = match ty::get(t).sty {
404+
ty::ty_bare_fn(ref fn_ty) => {
405+
let c = llvm_calling_convention(ccx, fn_ty.abis);
406+
c.unwrap_or(lib::llvm::CCallConv)
407+
}
408+
_ => lib::llvm::CCallConv
409+
};
402410
let llfn = base::register_fn_llvmty(ccx,
403411
sp,
404412
sym,
405413
node_id,
406-
lib::llvm::CCallConv,
414+
cconv,
407415
llfn_ty);
408416
add_argument_attributes(&tys, llfn);
409417
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",

0 commit comments

Comments
 (0)