From 6e114a367f97c3388240746ca506b1e34416a71d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 15 Jul 2011 16:40:04 -0700 Subject: [PATCH] rustc: Write names of local variables into the LLVM IR when debug mode is on --- src/comp/middle/trans.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 02a85383e353..2493569567da 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -6743,6 +6743,9 @@ fn alloc_ty(&@block_ctxt cx, &ty::t t) -> result { fn alloc_local(&@block_ctxt cx, &@ast::local local) -> result { auto t = node_id_type(cx.fcx.lcx.ccx, local.node.id); auto r = alloc_ty(cx, t); + if (cx.fcx.lcx.ccx.sess.get_opts().debuginfo) { + llvm::LLVMSetValueName(r.val, str::buf(local.node.ident)); + } r.bcx.fcx.lllocals.insert(local.node.id, r.val); ret r; }