[cfe-dev] [WIP patch] clang-query refactoring

Peter Collingbourne peter at pcc.me.uk
Fri Aug 15 14:49:38 PDT 2014


Hi,

Here's a patch for clang-query that adds some refactoring support. It has
no tests and probably has several bugs but I figured it would probably
be better to publish it now rather than let it continue to languish on my
workstation. An example session:

$ cat cqtest.cpp 
void g();

void f() {
  g();
}
$ clang-query cqtest.cpp 
clang-query> rewrite add declRefExpr(to(functionDecl(hasName("g"))))
Rewriter 0 created.
clang-query> rewrite rule 0 add root h
Rewrite rule 0 created.
clang-query> rewrite apply 0
Can't find usable .clang-format, using LLVM style
clang-query> ^D
$ cat cqtest.cpp 
void g();

void f() { h(); }

Thanks,
-- 
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Initial-version-of-clang-query-refactoring-tool.patch
Type: text/x-diff
Size: 21351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140815/946c0fb1/attachment.patch>


More information about the cfe-dev mailing list