memberCallExpr(
// Where the callee is a method called “Get”…
callee(method(hasName(“Get”))),
callee(methodDecl(hasName(“Get”))),
// … and the class on which the method is called is derived
// from ElementsBase …
thisPointerType(record(
thisPointerType(recordDecl(
isDerivedFrom(“ElementsBase”))),
// … and bind the member expression to the ID “member”, under which
// it can later be found in the callback.
doesn't compile with the current clang source. Hacking it based on
samples in tools/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
--- orig/RenameMethod.cpp 2012-07-02 15:22:34.000000000 -0400
+++ RenameMethod.cpp 2013-04-25 15:50:48.000000000 -0400
@@ -122,22 +122,22 @@ int main(int argc, const char **argv) {
CallRenamer CallCallback(&Tool.getReplacements());
Finder.addMatcher(
// Match calls...
- call(
+ memberCallExpr(
// Where the callee is a method called "Get"...
- callee(method(hasName("Get"))),
+ callee(methodDecl(hasName("Get"))),
// ... and the class on which the method is called is derived
// from ElementsBase ...
- thisPointerType(record(
+ thisPointerType(recordDecl(
isDerivedFrom("ElementsBase"))),
// ... and bind the member expression to the ID "member", under
which
// it can later be found in the callback.
- callee(id("member", memberExpression()))),
+ callee(id("member", memberExpr()))),
&CallCallback);