[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions

Chris Lattner clattner at apple.com
Wed Apr 29 19:47:26 PDT 2009


On Apr 29, 2009, at 6:43 PM, Sarah Thompson wrote:

> Hmm... if I do a print() on the result of getFileName(), I get
>
> 	i8 * getelementptr ([9 x i8]* @.str, i32 0, i32 0)
>
> back, but if I try to dyn_cast this to GetElementPtrInst it fails
> (returning null), so presumably I'm seeing a
> GetElementPtrConstantExpr... so how can I get at that constant i8
> array without casting to a GetElementPtrInst, and with
> GetElementPtrConstantExpr being inaccessible to user code?

Use something like:

if (ConstantExpr *CE = dyn_cast< ConstantExpr>(V))
   if (CE->getOpcode() == Instruction::GetElementPtr)
     ... play with CE->getOperand(0) etc ...

-Chris




More information about the llvm-dev mailing list