[cfe-dev] [clang-tidy] Policy about requirements for modernize checks

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Tue May 3 01:43:27 PDT 2016


Hi guys,
Some thoughts that started in http://reviews.llvm.org/D18919:
Is there any policy about requirements for modernize checks?

" I see that some checks from modernize require C++11 (e.g.
modernize-make-unique which is in C++14) and other require just C++
(modernize-loop-convert), and it even has a 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.
if (!getLangOpts().CPlusPlus)
  return;

I have 2 thoughts for this:

   1. there should be note in documentation about it, so the user won't
   spend time debuging why the check doesn't do anything. e.g. "This check
   requires to compile code with C++11 or higher"
   2. I would suggest modernize checks to require standard version the same
   or higher for C++ standars(featchures) that doesn't break backwards
   compatibility:

e.g. loop-convert should require C++11, make-shared C++14,
modernize-use-using also C++11 (because user can just start using C++11 or
C++14 without any problems)
but for modernize-increment-bool, that is deprecated in C++17, it should
require just C++ (because if someone need it, the he won't be able to
compile his code with C++17)."


Do you think this idea is good?


Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160503/aca2d218/attachment.html>


More information about the cfe-dev mailing list