[PATCH] D82728: [clang] Add -Wsuggest-override
Logan Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 19 16:43:35 PDT 2020
logan-5 added a comment.
In D82728#2161152 <https://reviews.llvm.org/D82728#2161152>, @xbolva00 wrote:
> Is it possible to emit fixit note with "override" ?
This is a good idea, though unfortunately (after eyeballing the implementation of `modernize-use-override` in clang-tidy (UseOverrideCheck.cpp)), it looks non-trivial to figure out where exactly to insert `override`. There's some significant logic in the clang-tidy check involving re-lexing the relevant tokens, to find the insertion point in the presence of complexity like inline definitions, `= 0`, `= {delete|default}`, function try blocks, macros, and the list goes on.
The clang-tidy check has this FIXME comment to address the complexity (UseOverrideCheck.cpp:136):
// FIXME: Instead of re-lexing and looking for specific macros such as
// 'ABSTRACT', properly store the location of 'virtual' and '= 0' in each
// FunctionDecl.
If this was done, the resulting information would presumably simplify the clang-tidy check as well as make it easier to add a fixit to this warning. This sounds like an interesting problem, but also like a sizable refactor, and I won't be upset if someone beats me to it. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82728/new/
https://reviews.llvm.org/D82728
More information about the cfe-commits
mailing list