<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hello,<br><br>I am new to clang development and I would like to have your<br>opinion on how I can do a specific task.<br><br>I want to add a static analysis to the compilation of C++ part of<br>Android applications (clang is the default compiler).<br><br>During this analysis I want to locate the call of specific functions<br>and then determine the type of the right value of the last<br>assignation of their arguments.<br><br>For example, if I track functions f1 and f2 in the following snippet:<br>"<br>unsigned long x1 = 0;<br>unsigned int x2 = 0;<br>unsigned char x3 = 0;<br><br>x1 = malloc(...);<br>x2 = 42;<br>x3 = 'x';<br>x2 = x3;<br><br>f1(x1);<br>f2(x2);<br>"<br>The analysis should return me "f1, void*" and "f2, unsigned char".<br><br>Ideally, this analysis should generate a warning during the<br>compilation process (depending on other conditions not mentioned<br>here). However, if it is an external tool it is fully acceptable.<br><br>I don't know if this kind of analysis is already present in clang but<br>I think that it will be easier to implement it over CFG of llvm IR<br>than over clang AST.<br><br>I have looked at clang and llvm documentation but the different<br>methods that I have seen do not seem to fulfill my requirements:<br>- libclang or clang plugin: it seems that I can only access to the AST.<br>- llvm pass: I won't be able to generate a warning.<br><br>Do you have any advice about which interface I should use? Do you know<br>any project/tool that could be good example and inspire me?<br><br>Thank you very much,<br><br>Pierre GRAUX<br data-mce-bogus="1"></div></div></body></html>