[cfe-dev] RenameMethod.cpp compilation errors
Manuel Klimek
klimek at google.com
Thu Apr 25 13:25:03 PDT 2013
On Thu, Apr 25, 2013 at 9:55 PM, Peeter Joot <peeter.joot at gmail.com> wrote:
> 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.
>
The tooling/ branch is currently unsupported. We're planning to start a
better rename tool into the extra/tools repo in the upcoming months...
Cheers,
/Manuel
>
> --
> Peeter
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130425/74861fb7/attachment.html>
More information about the cfe-dev
mailing list