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 repository.
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
- How do I unit test the negative of isCanonicalDecl?
- Will someone help me with a better description of isCanonicalDecl for the comment?
Adds the -add-override refactor to the cpp11-migrate tool
- 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?
- 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 changes?
add-override-clang_174296.patch (2.92 KB)