[clang-tidy] rename_check.py {misc,bugprone}-macro-parentheses
authorAlexander Kornienko <alexfh@google.com>
Thu, 15 Mar 2018 08:25:39 +0000 (08:25 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 15 Mar 2018 08:25:39 +0000 (08:25 +0000)
llvm-svn: 327606

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/MacroParenthesesCheck.cpp [moved from clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp with 99% similarity]
clang-tools-extra/clang-tidy/bugprone/MacroParenthesesCheck.h [moved from clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.h with 83% similarity]
clang-tools-extra/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-parentheses.rst [moved from clang-tools-extra/docs/clang-tidy/checks/misc-macro-parentheses.rst with 85% similarity]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/bugprone-macro-parentheses-cmdline.cpp [moved from clang-tools-extra/test/clang-tidy/misc-macro-parentheses-cmdline.cpp with 79% similarity]
clang-tools-extra/test/clang-tidy/bugprone-macro-parentheses.cpp [moved from clang-tools-extra/test/clang-tidy/misc-macro-parentheses.cpp with 82% similarity]

index ff35641..4b530e7 100644 (file)
@@ -22,6 +22,7 @@
 #include "IncorrectRoundingsCheck.h"
 #include "IntegerDivisionCheck.h"
 #include "LambdaFunctionNameCheck.h"
+#include "MacroParenthesesCheck.h"
 #include "MacroRepeatedSideEffectsCheck.h"
 #include "MisplacedOperatorInStrlenInAllocCheck.h"
 #include "MisplacedWideningCastCheck.h"
@@ -73,6 +74,8 @@ public:
         "bugprone-integer-division");
     CheckFactories.registerCheck<LambdaFunctionNameCheck>(
         "bugprone-lambda-function-name");
+    CheckFactories.registerCheck<MacroParenthesesCheck>(
+        "bugprone-macro-parentheses");
     CheckFactories.registerCheck<MacroRepeatedSideEffectsCheck>(
         "bugprone-macro-repeated-side-effects");
     CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>(
index a34d3fd..1fad72e 100644 (file)
@@ -14,6 +14,7 @@ add_clang_library(clangTidyBugproneModule
   IncorrectRoundingsCheck.cpp
   IntegerDivisionCheck.cpp
   LambdaFunctionNameCheck.cpp
+  MacroParenthesesCheck.cpp
   MacroRepeatedSideEffectsCheck.cpp
   MisplacedOperatorInStrlenInAllocCheck.cpp
   MisplacedWideningCastCheck.cpp
@@ -14,7 +14,7 @@
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace bugprone {
 
 namespace {
 class MacroParenthesesPPCallbacks : public PPCallbacks {
@@ -255,6 +255,6 @@ void MacroParenthesesCheck::registerPPCallbacks(CompilerInstance &Compiler) {
           &Compiler.getPreprocessor(), this));
 }
 
-} // namespace misc
+} // namespace bugprone
 } // namespace tidy
 } // namespace clang
@@ -7,14 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_PARENTHESES_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_PARENTHESES_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROPARENTHESESCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROPARENTHESESCHECK_H
 
 #include "../ClangTidy.h"
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace bugprone {
 
 /// Finds macros that can have unexpected behaviour due to missing parentheses.
 ///
@@ -36,8 +36,8 @@ public:
   void registerPPCallbacks(CompilerInstance &Compiler) override;
 };
 
-} // namespace misc
+} // namespace bugprone
 } // namespace tidy
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_PARENTHESES_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROPARENTHESESCHECK_H
index 30b8efe..023288e 100644 (file)
@@ -4,7 +4,6 @@ add_clang_library(clangTidyMiscModule
   MisplacedConstCheck.cpp
   UnconventionalAssignOperatorCheck.cpp
   DefinitionsInHeadersCheck.cpp
-  MacroParenthesesCheck.cpp
   MiscTidyModule.cpp
   NewDeleteOverloadsCheck.cpp
   NonCopyableObjects.cpp
index 56e6492..a5f017e 100644 (file)
@@ -11,7 +11,6 @@
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
 #include "DefinitionsInHeadersCheck.h"
-#include "MacroParenthesesCheck.h"
 #include "MisplacedConstCheck.h"
 #include "NewDeleteOverloadsCheck.h"
 #include "NonCopyableObjects.h"
@@ -39,8 +38,6 @@ public:
         "misc-unconventional-assign-operator");
     CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
         "misc-definitions-in-headers");
-    CheckFactories.registerCheck<MacroParenthesesCheck>(
-        "misc-macro-parentheses");
     CheckFactories.registerCheck<NewDeleteOverloadsCheck>(
         "misc-new-delete-overloads");
     CheckFactories.registerCheck<NonCopyableObjectsCheck>(
index 68ea431..1ca0a0b 100644 (file)
@@ -94,12 +94,12 @@ Improvements to clang-tidy
   Warns if global, non-trivial objects with static storage are constructed,
   unless the object is statically initialized with a ``constexpr`` constructor
   or has no explicit constructor.
-  
+
 - New `fuchsia-trailing-return
   <http://clang.llvm.org/extra/clang-tidy/checks/fuchsia-trailing-return.html>`_ check
 
-  Functions that have trailing returns are disallowed, except for those 
-  using ``decltype`` specifiers and lambda with otherwise unutterable 
+  Functions that have trailing returns are disallowed, except for those
+  using ``decltype`` specifiers and lambda with otherwise unutterable
   return types.
 
 - New `modernize-use-uncaught-exceptions
@@ -128,6 +128,9 @@ Improvements to clang-tidy
 - The 'misc-lambda-function-name' check was renamed to `bugprone-lambda-function-name
   <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-lambda-function-name.html>`_
 
+- The 'misc-macro-parentheses' check was renamed to `bugprone-macro-parentheses
+  <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-macro-parentheses.html>`_
+
 - The 'misc-macro-repeated-side-effects' check was renamed to `bugprone-macro-repeated-side-effects
   <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-macro-repeated-side-effects.html>`_
 
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - misc-macro-parentheses
+.. title:: clang-tidy - bugprone-macro-parentheses
 
-misc-macro-parentheses
-======================
+bugprone-macro-parentheses
+==========================
 
 
 Finds macros that can have unexpected behaviour due to missing parentheses.
index c64646b..3e2006e 100644 (file)
@@ -30,6 +30,7 @@ Clang-Tidy Checks
    bugprone-incorrect-roundings
    bugprone-integer-division
    bugprone-lambda-function-name
+   bugprone-macro-parentheses
    bugprone-macro-repeated-side-effects
    bugprone-misplaced-operator-in-strlen-in-alloc
    bugprone-misplaced-widening-cast
@@ -140,7 +141,6 @@ Clang-Tidy Checks
    llvm-namespace-comment
    llvm-twine-local
    misc-definitions-in-headers
-   misc-macro-parentheses
    misc-misplaced-const
    misc-new-delete-overloads
    misc-non-copyable-objects
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-macro-parentheses %t -- -- -DVAL=0+0
+// RUN: %check_clang_tidy %s bugprone-macro-parentheses %t -- -- -DVAL=0+0
 
 // The previous command-line is producing warnings and fixes with the source
 // locations from a virtual buffer. VAL is replaced by '0+0'.
@@ -1,15 +1,15 @@
-// RUN: %check_clang_tidy %s misc-macro-parentheses %t
+// RUN: %check_clang_tidy %s bugprone-macro-parentheses %t
 
 #define BAD1              -1
-// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: macro replacement list should be enclosed in parentheses [misc-macro-parentheses]
+// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
 #define BAD2              1+2
-// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: macro replacement list should be enclosed in parentheses [misc-macro-parentheses]
+// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: macro replacement list should be enclosed in parentheses [bugprone-macro-parentheses]
 #define BAD3(A)           (A+1)
-// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: macro argument should be enclosed in parentheses [misc-macro-parentheses]
+// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
 #define BAD4(x)           ((unsigned char)(x & 0xff))
-// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: macro argument should be enclosed in parentheses [misc-macro-parentheses]
+// CHECK-MESSAGES: :[[@LINE-1]]:44: warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
 #define BAD5(X)           A*B=(C*)X+2
-// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: macro argument should be enclosed in parentheses [misc-macro-parentheses]
+// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: macro argument should be enclosed in parentheses [bugprone-macro-parentheses]
 
 #define GOOD1             1
 #define GOOD2             (1+2)