[LLVMdev] source line number for instruction

Trevor Harmon Trevor.W.Harmon at nasa.gov
Wed Jul 7 13:08:43 PDT 2010


On Jul 6, 2010, at 10:44 PM, Guoliang Jin wrote:

> I found the following at http://llvm.org/docs/SourceLevelDebugging.html#ccxx_frontend 
> :
>  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();
>  }
> Does this also work for release 2.7?

Yes.

> I did not see the same thing at the documentation for release 2.7.

The link you cited is the documentation for release 2.7.

Trevor




More information about the llvm-dev mailing list