[cfe-dev] Adding -add-override functionality to cpp11-migrate tool

Philip Dunstan phil at philipdunstan.com
Sun Feb 3 17:32:35 PST 2013


These patches continue some work that I started back in July (before RL
kicked in) to create a C++11 migration tool that would add the override
specifier to suitable member functions where it could. I have reworked the
tool to integrate it into the cpp11-migrate tool in the tool/extra

There are two patches - one on the clang repo with some AST matchers and
the other in tool/extra. I have a couple of questions for each of the
patches that I would appreciate some help with.

Adds ASTMatchers isCanonicalDecl, isVirtual and isOverride

1. How do I unit test the negative of isCanonicalDecl?
2. Will someone help me with a better description of isCanonicalDecl for
the comment?

Adds the -add-override refactor to the cpp11-migrate tool

1. I don't like the work in AddOverrideActions.cpp to identify the desired
location of the override keyword if there is an inlined body (work
backwards from the start of the body to the first non-whitespace
character). This doesn't work if there is a comment between the declaration
and the body (shown in the comment_before_inline_body_fail test) and I
don't think it is correct if there are user . Will someone please suggest a
better way to do this?
2. I'm seeing a warning from the cpp11-migrate tool because C++11 is not
enabled in the compiler options during the initial parsing of the source. I
think that C++11 should be enabled as I expect this tool to be used on code
that has already been partly migrated to C++11. I would also expect that
this issue will arise as people run the migration tool with multiple
refactoring tool options.

Should I be using the git repo or llvm-reviews.chandlerc.com for these

Philip Dunstan
phil at philipdunstan.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130204/6d2d6d6b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override-clang_174296.patch
Type: application/octet-stream
Size: 2993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130204/6d2d6d6b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-override-clang_tools_extra_174296.patch
Type: application/octet-stream
Size: 16857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130204/6d2d6d6b/attachment-0001.obj>

More information about the cfe-dev mailing list