[clang-tidy] rename_check.py misc-sizeof-container bugprone-sizeof-container
authorAlexander Kornienko <alexfh@google.com>
Thu, 15 Mar 2018 08:26:47 +0000 (08:26 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 15 Mar 2018 08:26:47 +0000 (08:26 +0000)
llvm-svn: 327608

clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.cpp [moved from clang-tools-extra/clang-tidy/misc/SizeofContainerCheck.cpp with 97% similarity]
clang-tools-extra/clang-tidy/bugprone/SizeofContainerCheck.h [moved from clang-tools-extra/clang-tidy/misc/SizeofContainerCheck.h with 72% 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-sizeof-container.rst [moved from clang-tools-extra/docs/clang-tidy/checks/misc-sizeof-container.rst with 88% similarity]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/bugprone-sizeof-container.cpp [moved from clang-tools-extra/test/clang-tidy/misc-sizeof-container.cpp with 91% similarity]

index 922a79d..ac218d7 100644 (file)
@@ -28,6 +28,7 @@
 #include "MisplacedWideningCastCheck.h"
 #include "MoveForwardingReferenceCheck.h"
 #include "MultipleStatementMacroCheck.h"
+#include "SizeofContainerCheck.h"
 #include "SizeofExpressionCheck.h"
 #include "StringConstructorCheck.h"
 #include "StringIntegerAssignmentCheck.h"
@@ -87,6 +88,8 @@ public:
         "bugprone-move-forwarding-reference");
     CheckFactories.registerCheck<MultipleStatementMacroCheck>(
         "bugprone-multiple-statement-macro");
+    CheckFactories.registerCheck<SizeofContainerCheck>(
+        "bugprone-sizeof-container");
     CheckFactories.registerCheck<SizeofExpressionCheck>(
         "bugprone-sizeof-expression");
     CheckFactories.registerCheck<StringConstructorCheck>(
index 4bd83a9..1c8b9b4 100644 (file)
@@ -20,6 +20,7 @@ add_clang_library(clangTidyBugproneModule
   MisplacedWideningCastCheck.cpp
   MoveForwardingReferenceCheck.cpp
   MultipleStatementMacroCheck.cpp
+  SizeofContainerCheck.cpp
   SizeofExpressionCheck.cpp
   StringConstructorCheck.cpp
   StringIntegerAssignmentCheck.cpp
@@ -15,7 +15,7 @@ using namespace clang::ast_matchers;
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace bugprone {
 
 void SizeofContainerCheck::registerMatchers(MatchFinder *Finder) {
   Finder->addMatcher(
@@ -44,6 +44,6 @@ void SizeofContainerCheck::check(const MatchFinder::MatchResult &Result) {
                                   "container; did you mean .size()?");
 }
 
-} // namespace misc
+} // namespace bugprone
 } // namespace tidy
 } // namespace clang
@@ -7,20 +7,20 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_CONTAINER_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_CONTAINER_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFCONTAINERCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFCONTAINERCHECK_H
 
 #include "../ClangTidy.h"
 
 namespace clang {
 namespace tidy {
-namespace misc {
+namespace bugprone {
 
 /// Find usages of sizeof on expressions of STL container types. Most likely the
 /// user wanted to use `.size()` instead.
 ///
 /// For the user-facing documentation see:
-/// http://clang.llvm.org/extra/clang-tidy/checks/misc-sizeof-container.html
+/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-container.html
 class SizeofContainerCheck : public ClangTidyCheck {
 public:
   SizeofContainerCheck(StringRef Name, ClangTidyContext *Context)
@@ -29,8 +29,8 @@ public:
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
 };
 
-} // namespace misc
+} // namespace bugprone
 } // namespace tidy
 } // namespace clang
 
-#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_CONTAINER_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFCONTAINERCHECK_H
index 4d8cedd..e81a528 100644 (file)
@@ -8,7 +8,6 @@ add_clang_library(clangTidyMiscModule
   NewDeleteOverloadsCheck.cpp
   NonCopyableObjects.cpp
   RedundantExpressionCheck.cpp
-  SizeofContainerCheck.cpp
   StaticAssertCheck.cpp
   ThrowByValueCatchByReferenceCheck.cpp
   UniqueptrResetReleaseCheck.cpp
index 9a9ebb6..b49f794 100644 (file)
@@ -15,7 +15,6 @@
 #include "NewDeleteOverloadsCheck.h"
 #include "NonCopyableObjects.h"
 #include "RedundantExpressionCheck.h"
-#include "SizeofContainerCheck.h"
 #include "StaticAssertCheck.h"
 #include "ThrowByValueCatchByReferenceCheck.h"
 #include "UnconventionalAssignOperatorCheck.h"
@@ -43,7 +42,6 @@ public:
         "misc-non-copyable-objects");
     CheckFactories.registerCheck<RedundantExpressionCheck>(
         "misc-redundant-expression");
-    CheckFactories.registerCheck<SizeofContainerCheck>("misc-sizeof-container");
     CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
     CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
         "misc-throw-by-value-catch-by-reference");
index fa1a6e0..ffb3c45 100644 (file)
@@ -137,6 +137,9 @@ Improvements to clang-tidy
 - The 'misc-misplaced-widening-cast' check was renamed to `bugprone-misplaced-widening-cast
   <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-misplaced-widening-cast.html>`_
 
+- The 'misc-sizeof-container' check was renamed to `bugprone-sizeof-container
+  <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-container.html>`_
+
 - The 'misc-sizeof-expression' check was renamed to `bugprone-sizeof-expression
   <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-expression.html>`_
 
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - misc-sizeof-container
+.. title:: clang-tidy - bugprone-sizeof-container
 
-misc-sizeof-container
-=====================
+bugprone-sizeof-container
+=========================
 
 The check finds usages of ``sizeof`` on expressions of STL container types. Most
 likely the user wanted to use ``.size()`` instead.
index b30a41d..9194d62 100644 (file)
@@ -36,6 +36,7 @@ Clang-Tidy Checks
    bugprone-misplaced-widening-cast
    bugprone-move-forwarding-reference
    bugprone-multiple-statement-macro
+   bugprone-sizeof-container
    bugprone-sizeof-expression
    bugprone-string-constructor
    bugprone-string-integer-assignment
@@ -146,7 +147,6 @@ Clang-Tidy Checks
    misc-new-delete-overloads
    misc-non-copyable-objects
    misc-redundant-expression
-   misc-sizeof-container
    misc-static-assert
    misc-throw-by-value-catch-by-reference
    misc-unconventional-assign-operator
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-sizeof-container %t -- -- -std=c++11 -target x86_64-unknown-unknown
+// RUN: %check_clang_tidy %s bugprone-sizeof-container %t -- -- -std=c++11 -target x86_64-unknown-unknown
 
 namespace std {
 
@@ -64,7 +64,7 @@ void f() {
   std::vector<int> v;
 
   int a = 42 + sizeof(s1);
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: sizeof() doesn't return the size of the container; did you mean .size()? [misc-sizeof-container]
+// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: sizeof() doesn't return the size of the container; did you mean .size()? [bugprone-sizeof-container]
   a = 123 * sizeof(s2);
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: sizeof() doesn't return the size
   a = 45 + sizeof(s2 + "asdf");