[cfe-dev] Code instrumentation in Clang?
rrankene at gmail.com
Sat Jan 28 17:10:31 PST 2012
I would like to instrument the C/C++ source so that it can be compiled
under most any compiler, not just Clang. The only way I see to do
that would be either through libclang or maybe with a recursive AST
visitor. I was hoping to find a good example to work from, assuming I
need a Rewriter. If there's something I'm missing, feel free to
On Mon, Jan 23, 2012 at 9:58 AM, Kostya Serebryany [via Clang
Developers] <ml-node+s42468n3682517h74 at n3.nabble.com> wrote:
> Why would you want to add instrumentation in Clang and not in LLVM?
> For an example of LLVM instrumentation pass, take a look
> at lib/Transforms/Instrumentation/AddressSanitizer.cpp.
> On Sat, Jan 21, 2012 at 8:13 AM, Robert Ankeney <[hidden email]> wrote:
>> I'm trying to get up to speed on using Clang by doing a bit of dynamic
>> code analysis by instrumenting C (and maybe C++) code where I take a
>> source file and generate an instrumented output. I'd like to add a
>> function call at the beginning of any block to mark statement coverage
>> and also change all boolean expressions to call some function so I can
>> track that too. For example:
>> foo = a && (b || c);
>> would become something like:
>> foo = EXPR_AND(a, EXPR_OR(b, c));
>> and thus I can track all combinations of conditions that occur. I'd
>> need to track where in the source code I am too, and save that info
>> seperately. This is a bit beyond what gcov provides.
>> I'm gussing that using a RecursiveASTVisitor would be the best
>> approach, but whatever approach I take, is there an easy way to output
>> the C code for each node I visit?
>> Any suggestions of what to look at to accomplish something like this
>> would be most appreciated!
>> cfe-dev mailing list
>> [hidden email]
> cfe-dev mailing list
> [hidden email]
> If you reply to this email, your message will be added to the discussion
> To unsubscribe from Code instrumentation in Clang?, click here.
View this message in context: http://clang-developers.42468.n3.nabble.com/Code-instrumentation-in-Clang-tp3678010p3696802.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev