[PATCH] [clang-tidy] Add an option to replace unrecognized namespace ending comments.

Alexander Kornienko alexfh at google.com
Thu Mar 5 06:56:33 PST 2015


In http://reviews.llvm.org/D8078#134852, @djasper wrote:

> I think adding this option is a way of copping out of fixing this correctly.
>
> For now, I'd be fine saying always to overwrite such a comment. Either a project, enforcing such comment, then they won't have a different comment in the same place or they don't. If clang-tidy complains about / overwrites one of your comments, you'll reinstate it at a better location prior to submit.


Frankly, the need for this option was not dictated by a specific request or an observation, rather an assumption that it may be needed. You're probably right that in this rare situation fixing up the change by hand is a proper solution and usually there's a better place for an unrelated comment than where a namespace ending comment should be.

> A next step might be to analyze whether a comment in that place is meant to close the namespace, e.g. by checking whether its content contains at least one of "namespace" or <namespace-name>.


It may be not completely trivial to guess the intention, as the problem usually arises when there's a typo (namesapce, anoynmous, etc.). So we'd need to split the comment and look for keywords with a limit on the edit distance or do something similar. This may not worth it.


http://reviews.llvm.org/D8078

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list