[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [creduce-dev] templates
On 02/16/2016 08:38 AM, John Regehr wrote:
But, I haven't hacked clang before and am not even sure how to get
started. Is there anyone here who hacks on clang who could give me a
quick outline of what the implementation to these would probably look
like? What APIs to use, basically?
I can write up an outline about how to write a clang_delta pass in a
couple of days. In the meanwhile, you can check out the excellent
example given by Eli Bendersky:
https://github.com/eliben/llvm-clang-samples/blob/master/src_clang/rewritersample.cpp
Both Eli's example and clang_delta follow the same principle:
(1) Inherit RecursiveASTVisitor to visit AST nodes; and
(2) rely on the Rewriter to rewrite the given source file.
- Yang