Clang code instrumentation

Hi to all,

I'm newbie to clang and like to do some code instrumentation with it.
To instrument the statement coverage of functions i put some static
instrumentation counter
at proper code locations with AST rewriter.

At the end of every file instrumenation i'd like to correct the array number
of instrumented points
individually for each file within the static structure which includes an
array of int counters for each
detected file. This file could be a seperate header file or may be a part of
the instrumented file itself.

Does anyone has an idea how to achieve this in clang?

Thanks in advance


What problems are you specifically looking at? It’s not clear from your e-mail what the difficulty is. You can insert arbitrary text to the source code using clang::Rewriter, and get any clang::SourceLocation-s from the AST nodes and clang::SourceManager.