Revision: 3410 http://trac.macosforge.org/projects/ruby/changeset/3410 Author: lsansonetti@apple.com Date: 2010-02-01 21:31:53 -0800 (Mon, 01 Feb 2010) Log Message: ----------- let's attach more metadata Modified Paths: -------------- MacRuby/trunk/compiler.cpp MacRuby/trunk/compiler.h Modified: MacRuby/trunk/compiler.cpp =================================================================== --- MacRuby/trunk/compiler.cpp 2010-02-02 04:08:33 UTC (rev 3409) +++ MacRuby/trunk/compiler.cpp 2010-02-02 05:31:53 UTC (rev 3410) @@ -739,6 +739,16 @@ params.end(), "", bb); } +void +RoxorCompiler::attach_current_line_metadata(Instruction *insn) +{ + if (fname != NULL) { + DILocation loc = debug_info->CreateLocation(current_line, 0, + debug_compile_unit, DILocation(NULL)); + context.getMetadata().addMD(dbg_mdkind, loc.getNode(), insn); + } +} + Value * RoxorCompiler::compile_dispatch_call(std::vector<Value *> ¶ms) { @@ -759,11 +769,7 @@ } Instruction *insn = compile_protected_call(dispatcherFunc, params); - if (fname != NULL) { - DILocation loc = debug_info->CreateLocation(current_line, 0, - debug_compile_unit, DILocation(NULL)); - context.getMetadata().addMD(dbg_mdkind, loc.getNode(), insn); - } + attach_current_line_metadata(insn); return insn; } @@ -3962,7 +3968,10 @@ (flags & DEFINE_OUTER) && dynamic_class ? 1 : 0)); - classVal = compile_protected_call(defineClassFunc, params); + Instruction *insn + = compile_protected_call(defineClassFunc, params); + attach_current_line_metadata(insn); + classVal = insn; } NODE *body = node->nd_body; @@ -4009,7 +4018,9 @@ std::vector<Value *> params; params.push_back(classVal); params.push_back(compile_const_pointer(NULL)); - val = compile_protected_call(f, params); + Instruction *insn = compile_protected_call(f, params); + attach_current_line_metadata(insn); + val = insn; dynamic_class = old_dynamic_class; compile_set_current_scope(classVal, defaultScope); Modified: MacRuby/trunk/compiler.h =================================================================== --- MacRuby/trunk/compiler.h 2010-02-02 04:08:33 UTC (rev 3409) +++ MacRuby/trunk/compiler.h 2010-02-02 05:31:53 UTC (rev 3410) @@ -356,6 +356,8 @@ void compile_keep_vars(BasicBlock *startBB, BasicBlock *mergeBB); SEL mid_to_sel(ID mid, int arity); + + void attach_current_line_metadata(Instruction *insn); }; #define context (RoxorCompiler::module->getContext())