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

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 4 07:26:00 PDT 2017


+alex

On Thu, Aug 3, 2017 at 4:10 PM Dima Kozhevnikov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> 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
>

This might be an interesting one, if a standard lib removes auto_ptr with a
reasonably recent compiler standard.
Not sure whether we have similar checks that could fix breaking changes.

- 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.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170804/16ef30da/attachment.html>


More information about the cfe-dev mailing list