<div dir="ltr">The following example:<br><br><a href="http://llvm.org/svn/llvm-project/cfe/branches/tooling/examples/rename-method/RenameMethod.cpp">http://llvm.org/svn/llvm-project/cfe/branches/tooling/examples/rename-method/RenameMethod.cpp</a><br>
<br>doesn't compile with the current clang source. Hacking it based on samples in tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp <div><br></div><div><div>--- orig/RenameMethod.cpp 2012-07-02 15:22:34.000000000 -0400</div>
<div>+++ RenameMethod.cpp 2013-04-25 15:50:48.000000000 -0400</div><div>@@ -122,22 +122,22 @@ int main(int argc, const char **argv) {</div><div> CallRenamer CallCallback(&Tool.getReplacements());</div><div> Finder.addMatcher(</div>
<div> // Match calls...</div><div>- call(</div><div>+ memberCallExpr(</div><div> // Where the callee is a method called "Get"...</div><div>- callee(method(hasName("Get"))),</div><div>
+ callee(methodDecl(hasName("Get"))),</div><div> // ... and the class on which the method is called is derived</div><div> // from ElementsBase ...</div><div>- thisPointerType(record(</div><div>
+ thisPointerType(recordDecl(</div><div> isDerivedFrom("ElementsBase"))),</div><div> // ... and bind the member expression to the ID "member", under which</div><div> // it can later be found in the callback.</div>
<div>- callee(id("member", memberExpression()))),</div><div>+ callee(id("member", memberExpr()))),</div><div> &CallCallback);</div><div><br></div><div> DeclRenamer DeclCallback(&Tool.getReplacements());</div>
<div> Finder.addMatcher(</div><div> // Match declarations...</div><div>- id("method", method(hasName("Get"),</div><div>+ id("method", methodDecl(hasName("Get"),</div><div>
ofClass(isDerivedFrom("ElementsBase")))),</div><div> &DeclCallback);</div><div><br></div><div style>appears to be enough to make it compile.</div><div><div><br></div>-- <br>Peeter
</div></div></div>