<div style="color:rgb(34,34,34);font-size:12.727272033691406px;font-family:arial,sans-serif">Hi all,</div><div style="color:rgb(34,34,34);font-size:12.727272033691406px;font-family:arial,sans-serif">
<br></div><div style="color:rgb(34,34,34);font-size:12.727272033691406px;font-family:arial,sans-serif">I am working on my Master's project in security and I am trying to iterate over the argument list of the function. Basically I need to do following things :</div>
<div style="color:rgb(34,34,34);font-size:12.727272033691406px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:12.727272033691406px;font-family:arial,sans-serif">
1. Check data type of each argument of the argument list of the function.<br>2. Based on its data type like character array or integer array, pointer, int, char, take different action. <br>3. I have added following code to check its data type. <br>
<br>// F is any function basically of type function *<br> FunctionType *FTy = F->getFunctionType();<br>unsigned int numArgs = FTy->getNumParams();<br><br>//Currently just checking data type of the 0th argument. Eventually will be running it in the loop from 0 to numArgs.<br>
</div><div>
errs() << "\n1 Argument type int 32 : " << FTy->getParamType(0)->isIntegerTy(32);<br> errs() << "\n2 Argument type char : " << FTy->getParamType(0)->isIntegerTy(8);<br>
errs() << "\n4 Argument type pointer : " << FTy->getParamType(0)->isPointerTy();<br> errs() << "\n5 Argument type array : " << FTy->getParamType(0)->isArrayTy();<br>
errs() << "\n6 Argument type structure : " << FTy->getParamType(0)->isStructTy(); <br></div><br>I can just find these many data types for integer and characters. This just tells me that parameter is of type pointer or array or structure. <br>
<br>My question is if function's parameter type is pointer / array, how can I figure it out whether its character pointer or integer pointer? <br>Also if it is a array then how can I find size of the array? <br>In case of structure how to check exact structure definition I mean exactly it is instance of which structure? <br>
<br>Please let me know. <br><br>Thanks, <br>--Teja