Why would you want to add instrumentation in Clang and not in LLVM? <div>For an example of LLVM instrumentation pass, take a look at lib/Transforms/Instrumentation/AddressSanitizer.cpp. </div><div><br></div><div>--kcc <br>
<br><div class="gmail_quote">On Sat, Jan 21, 2012 at 8:13 AM, Robert Ankeney <span dir="ltr"><<a href="mailto:rrankene@gmail.com">rrankene@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm trying to get up to speed on using Clang by doing a bit of dynamic<br>
code analysis by instrumenting C (and maybe C++) code where I take a<br>
source file and generate an instrumented output. I'd like to add a<br>
function call at the beginning of any block to mark statement coverage<br>
and also change all boolean expressions to call some function so I can<br>
track that too. For example:<br>
        foo = a && (b || c);<br>
would become something like:<br>
        foo = EXPR_AND(a, EXPR_OR(b, c));<br>
and thus I can track all combinations of conditions that occur.  I'd<br>
need to track where in the source code I am too, and save that info<br>
seperately.  This is a bit beyond what gcov provides.<br>
I'm gussing that using a RecursiveASTVisitor would be the best<br>
approach, but whatever approach I take, is there an easy way to output<br>
the C code for each node I visit?<br>
Any suggestions of what to look at to accomplish something like this<br>
would be most appreciated!<br>
<br>
Thanks!<br>
Robert<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>