[cfe-dev] Language level for clang-tidy "modernize-*" checks

Dima Kozhevnikov via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 3 07:10:17 PDT 2017


Hello!

Currently some modernize-* checks in clang-tidy are applied regardless of
the C++ standard used (some of them having comments like "Because this
checker is used for modernization, it is reasonable to run it on any C++
standard with the assumption the user is trying to modernize their
codebase"). To name some:

- LoopConvertCheck
- PassByValueCheck
- ReplaceAutoPtrCheck
- UseAutoCheck
- UseEmplaceCheck
- UseEqualsDefaultCheck
- UseEqualsDeleteCheck
- UseNullptrCheck

Others are applied only when the current C++ standard is high enough,
namely:

- RawStringLiteralCheck
- ReplaceRandomShuffleCheck
- ReturnBracedInitListCheck
- ShrinkToFitCheck
- UseDefaultMemberInitCheck
- UseNoexceptCheck
- UseOverrideCheck
- UseTransparentFunctorsCheck
- UseUsingCheck
- Make{Shared/Unique}Check

The first approach is causing troubles when with our clang-tidy integration
in CLion, since diagnostics are emitted on a perfectly valid C++03 code,
and applying FixIts breaks compilation. We could deal with it on our side,
blacklisting specific checks (or "modernize-*" altogether) with older
standards; however, we'd like to avoid knowing about specific checks on our
side when possible. Additionally,

- The situation is obviously inconsistent between different checks
- I don't see much sense for the user to try "to modernize their codebase"
when the user can't do anything with the results anyway

I'd like to go through the first group and require the C++11 standard for
them, what do you think?

--
Best regards,
Dmitry Kozhevnikov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170803/9ee00263/attachment.html>


More information about the cfe-dev mailing list