This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Cleaning up language options.
ClosedPublic

Authored by xazax.hun on Sep 23 2016, 1:35 PM.

Details

Summary

In some cases do not register the matcher when the check method of a checker should not run anyways.

Refactor some checks to use a shorter way to get language options.

Diff Detail

Repository
rL LLVM

Event Timeline

xazax.hun updated this revision to Diff 72341.Sep 23 2016, 1:35 PM
xazax.hun retitled this revision from to [clang-tidy] Cleaning up language options..
xazax.hun updated this object.
xazax.hun added reviewers: hokein, alexfh.
xazax.hun set the repository for this revision to rL LLVM.
xazax.hun added a project: Restricted Project.
xazax.hun added a subscriber: cfe-commits.

I think will be good idea to enable modernize-loop-convert, modernize-use-auto, modernize-use-default, modernize-use-nullptr only in C++11 mode.

Probably modernize-avoid-bind code code be simplified too.

I think will be good idea to enable modernize-loop-convert, modernize-use-auto, modernize-use-default, modernize-use-nullptr only in C++11 mode.

Probably modernize-avoid-bind code code be simplified too.

As far as I can see there is a discrepancy between these modernization checks. Loop convert, use auto, use default, use nullptr is registered for older standards deliberately.

See the following comment:

// Only register the matchers for C++. 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.

So basically the question is: should we require the users to run the clang tidy in C++11 mode (hence change their build settings) to get these modernization checks?

I am okay with either of the answers but I wonder what do you think.

I think it's reasonable to compile code in C++11 with minimal changes (only modernize-replace-auto-ptr is really needed) and test it before further modernization.

alexfh accepted this revision.Sep 23 2016, 6:30 PM
alexfh edited edge metadata.

Thank you for the cleanup! Please clang-format-diff the files before submitting. Otherwise looks good.

This revision is now accepted and ready to land.Sep 23 2016, 6:30 PM
This revision was automatically updated to reflect the committed changes.