[LLVMdev] source line number for instruction

Guoliang Jin jingl1345 at gmail.com
Wed Jul 7 13:14:56 PDT 2010


  On 7/7/2010 3:08 PM, Trevor Harmon wrote:
> 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.
OK. Thanks. I will try it.
>
>> 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.
I thought it was documentation for mainline LLVM. Also I thought the 
documentation for release 2.7 was 
http://llvm.org/releases/2.7/docs/SourceLevelDebugging.html which does 
not mention the same example.

Guoliang




More information about the llvm-dev mailing list