[LLVMdev] set line number debug info
Frits van Bommel
fvbommel at gmail.com
Mon Mar 14 01:15:23 PDT 2011
On Mon, Mar 14, 2011 at 8:56 AM, Abhirup Ghosh <abhirupju at gmail.com> wrote:
> Hi,
> I am new to LLVM infrastructure. Recently I am trying to set the debug
> info for an instruction. The main aim is to set the source line number of an
> instruction. Can anyone please show how to do that?
> I think that setMetadata method in Instruction class is to be used.
> But how do I create MDNode* consisting of desired source line number. Source
> line number can be extracted from the instruction-debug-info using
> getMetadata method and then using getLineNumber method from DILocation
> class. Unfortunately DILocation class does not have any function like
> setLinenumber.
You may want to check out Instruction::setDebugLoc().
llvm/Support/DebugLoc.h and llvm/Analysis/DIBuilder.h will likely be
helpful as well.
More information about the llvm-dev
mailing list