Language level for clang-tidy "modernize-*" checks

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Language level for clang-tidy "modernize-*" checks

Sumner, Brian via cfe-dev
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.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Language level for clang-tidy "modernize-*" checks

Sumner, Brian via cfe-dev
+alex

On Thu, Aug 3, 2017 at 4:10 PM Dima Kozhevnikov via cfe-dev <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...