[PATCH] D18919: [Clang-tidy] Add check "modernize use using"

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 01:34:33 PDT 2016


Prazek added inline comments.

================
Comment at: clang-tidy/modernize/UseUsingCheck.cpp:22
@@ +21,3 @@
+void UseUsingCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus)
+    return;
----------------
hokein wrote:
> Should be CplusPlus11 here.
BTW is there any policy about that? 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 that doesn't break backwards compatibility:
e.g. loop-convert should require C++11, make-shared C++14, this check also C++11,
but for modernize-increment-bool, that is deprecated in C++17, it should require just C++ (because if someone need it, the he wont be able to compile his code with C++17).


Repository:
  rL LLVM

http://reviews.llvm.org/D18919





More information about the cfe-commits mailing list