[cfe-dev] RenameMethod.cpp compilation errors
Peeter Joot
peeter.joot at gmail.com
Thu Apr 25 12:55:07 PDT 2013
The following example:
http://llvm.org/svn/llvm-project/cfe/branches/tooling/examples/rename-method/RenameMethod.cpp
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);
DeclRenamer DeclCallback(&Tool.getReplacements());
Finder.addMatcher(
// Match declarations...
- id("method", method(hasName("Get"),
+ id("method", methodDecl(hasName("Get"),
ofClass(isDerivedFrom("ElementsBase")))),
&DeclCallback);
appears to be enough to make it compile.
--
Peeter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130425/696c4d4c/attachment.html>
More information about the cfe-dev
mailing list