[cfe-dev] Adding -add-override functionality to cpp11-migrate tool
matthieu.monrocq at gmail.com
Tue Feb 5 10:15:37 PST 2013
On Tue, Feb 5, 2013 at 6:44 PM, Philip Dunstan <phil at philipdunstan.com>wrote:
> Thanks everyone for your feedback,
> I've attached a new set of patches with the changes suggested by Dmitri,
> Matthieu and Edwin. I implemented many of the suggested changes but there
> are a couple of changes that I made or didn't make that I wanted to
> I've replaced the use of the isCanonicalDecl matcher with
> hasParent(recordDecl()) as suggested by Dmitri. I have removed the addition
> of the isCanonicalDecl matcher from my patch to ASTMatchers.h and
> I haven't modified yet how the insertion point for the override keyword is
> calculated. Dmitri suggested FunctionTypeLoc::getRParenLoc() but I don't
> think that this will work if there is a trailing const keyword or deferred
> return type. It's possible that with a bit of work this could be made to
> work, but I am concerned that there might be other situations where this
> wouldn't work that I am not aware of.
> Following Edwin's suggestion I am passing -std=c++11 to the cpp11-migrate
> tool in the unit tests to fix the warnings I was seeing.
> Dmitri suggested not using definitions such as
> const char *Method = "method";
> at TU scope in AddOverrideMatchers.cpp. I have left this as it is for now.
> I agree that there are concerns with such definitions but I would prefer
> this definition than a string literal in AddOverride.cpp.
> I have not implemented Matthieu's suggestion for finding a macro which
> matches the override keyword. I think that this would be an excellent thing
> to support but haven't done so because of the difficulty accessing the
> required Preprocessor object.
I think this is definitely more ambitious, so something that can be tacked
on later. As Vane said, at worst it could simply be an option:
There is certainly no reason to defer adding the new transformation for
> Philip Dunstan
> phil at philipdunstan.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev