[llvm-dev] [LLVMdev] DebugInfo from LLVM Instruction

Simone Atzeni via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 6 08:58:02 PDT 2015

Hi all,

I used to extract the debug information from an LLVM Instruction in the following way:

if (MDNode *N = I->getMetadata("dbg")) {  // Here I is an LLVM instruction
  DILocation Loc(N);                      // DILocation is in DebugInfo.h
  unsigned Line = Loc.getLineNumber();
  StringRef File = Loc.getFilename();
  StringRef Dir = Loc.getDirectory();

As specified also at http://llvm.org/docs/SourceLevelDebugging.html <http://llvm.org/docs/SourceLevelDebugging.html>

However, looks like that the instruction " DILocation Loc(N);” is not valid anymore,
Since the DILocation class is changed. 
Is that right?
How can I extract debug info (line, filename, etc.) from an instruction?

Best Regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150806/da745daa/attachment.html>

More information about the llvm-dev mailing list