[LLVMdev] Replacement for findStopPoint() in LLVM 2.7

Török Edwin edwintorok at gmail.com
Tue Mar 16 08:38:44 PDT 2010


On 03/16/2010 05:30 PM, John Criswell wrote:
> Török Edwin wrote:
>> [snip]
>>>> Something like this (you can of course cache TheMetadata and MDDbgKind)
>>>>
>>>> llvm::MetadataContext *TheMetadata = M->getContext().getMetadata();
>>>> MDDbgKind = TheMetadata->getMDKind("dbg");
>>>> if (MDDbgKind) {
>>>>   if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) {
>>>>         DILocation Loc(Dbg);
>>>>     ...
>>>>     Loc.getDirectory()
>>>>     Loc.getFilename()
>>>>     Loc.getLineNumber()
>>>>         Loc.getColumnNumber()
>>>>     ....
>>>>   }
>>>>         
>>> A grep through my LLVM 2.7 source tree does not find MetadataContext
>>> anywhere.  Is this something that was added to LLVM mainline after the
>>> LLVM 2.7 branch was created?
>>>     
>>
>> It should be there, include/llvm/Metadata.h.
>>   
> 
> Odd.  I just looked in there, and MetadataContext is not defined in that
> file.

Ah, the method got moved to the instruction itself!

dbgKind = Context->getMDKindID("dbg");
if (MDNode *Dbg = I->getMetadata(dbgKind)) {
...



More information about the llvm-dev mailing list