I need to preprocess some C++ files to automatically insert code for testing and profiling, and I need to do it with the clang API.
Fo
I agree that the documentation of CLang might be lacking in some area. This is, unfortunately, the way Open Source works: it will lacking until someone needs it, figures it out and decide to contribute back his findings.
For you specific problem I suggest you post on the Clang Dev mailing list (or begin by sifting through the archives). Questions about ASTConsumers or other transform analysis are quite frequent and usually promptly answered to.
And then, when you've learned what you were looking for, do think about upgrading the documentation ;)