[LLVMdev] set line number debug info

Devang Patel dpatel at apple.com
Fri Mar 25 08:36:50 PDT 2011


Abhirup,

On Mar 25, 2011, at 6:50 AM, Abhirup Ghosh wrote:

> Oh! I made a mistake by not using setDebugInfo() function present in the Instruction class. Now it's working fully.
> So, the solution is:- 
> To set the line number for an instruction -
> 1. Add a function in DebugLoc class located in llvm/Support/DebugLoc.h. Set the line number there to the private variable called LineCol.
> 2. Call the added function. And then pass the modified DebugLoc object to the seDebugInfo method for the instruction.

That's not the right way. You should create new DebugLoc object for every new line number and attach it to an instruction using setDebugLoc().

-
Devang



More information about the llvm-dev mailing list