Parse a Value of Struct Type to extract the item type


I am working on clang codegen module to parse some information in compile time. So, here is an example LLVM Value:

{ i64, i64 } { i64 ptrtoint (void (%class.Testpm*)* @_ZN6Testpm7m_func1Ev to i64), i64 0 }

I want to parse this Value so that I can check the source type using in ptrtoint casting instruction (i.e. void (%class.Testpm*)*). I have tried following:

if (isallvm::PtrToIntInst(Val)) {
llvm::IntToPtrInst *iptr = dyn_castllvm::PtrToIntInst(Val);

but it is not working. Any idea?


For this following code: