Skip to content

Commit 6e114a3

Browse files
committed
rustc: Write names of local variables into the LLVM IR when debug mode is on
1 parent fafb42e commit 6e114a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6743,6 +6743,9 @@ fn alloc_ty(&@block_ctxt cx, &ty::t t) -> result {
67436743
fn alloc_local(&@block_ctxt cx, &@ast::local local) -> result {
67446744
auto t = node_id_type(cx.fcx.lcx.ccx, local.node.id);
67456745
auto r = alloc_ty(cx, t);
6746+
if (cx.fcx.lcx.ccx.sess.get_opts().debuginfo) {
6747+
llvm::LLVMSetValueName(r.val, str::buf(local.node.ident));
6748+
}
67466749
r.bcx.fcx.lllocals.insert(local.node.id, r.val);
67476750
ret r;
67486751
}

0 commit comments

Comments
 (0)