aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2018-03-15 08:27:42 +0000
committerAlexander Kornienko <alexfh@google.com>2018-03-15 08:27:42 +0000
commit32a44d6e3a088d33b2e7a93d7cfc428ec946ae4c (patch)
treef87f08f4c1709019887b40858064b528803e852c
parent8c06718c3910e60534bb55dd0a521a882cee7ce1 (diff)
[clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@327610 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--clang-tidy/bugprone/BugproneTidyModule.cpp3
-rw-r--r--clang-tidy/bugprone/CMakeLists.txt1
-rw-r--r--clang-tidy/bugprone/UnusedRaiiCheck.cpp (renamed from clang-tidy/misc/UnusedRAIICheck.cpp)12
-rw-r--r--clang-tidy/bugprone/UnusedRaiiCheck.h (renamed from clang-tidy/misc/UnusedRAIICheck.h)18
-rw-r--r--clang-tidy/misc/CMakeLists.txt1
-rw-r--r--clang-tidy/misc/MiscTidyModule.cpp2
-rw-r--r--docs/ReleaseNotes.rst11
-rw-r--r--docs/clang-tidy/checks/bugprone-unused-raii.rst (renamed from docs/clang-tidy/checks/misc-unused-raii.rst)6
-rw-r--r--docs/clang-tidy/checks/list.rst2
-rw-r--r--test/clang-tidy/bugprone-unused-raii.cpp (renamed from test/clang-tidy/misc-unused-raii.cpp)2
10 files changed, 31 insertions, 27 deletions
diff --git a/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tidy/bugprone/BugproneTidyModule.cpp
index ac218d7c..5849da24 100644
--- a/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -42,6 +42,7 @@
#include "ThrowKeywordMissingCheck.h"
#include "UndefinedMemoryManipulationCheck.h"
#include "UndelegatedConstructorCheck.h"
+#include "UnusedRaiiCheck.h"
#include "UseAfterMoveCheck.h"
#include "VirtualNearMissCheck.h"
@@ -116,6 +117,8 @@ public:
"bugprone-undefined-memory-manipulation");
CheckFactories.registerCheck<UndelegatedConstructorCheck>(
"bugprone-undelegated-constructor");
+ CheckFactories.registerCheck<UnusedRaiiCheck>(
+ "bugprone-unused-raii");
CheckFactories.registerCheck<UseAfterMoveCheck>(
"bugprone-use-after-move");
CheckFactories.registerCheck<VirtualNearMissCheck>(
diff --git a/clang-tidy/bugprone/CMakeLists.txt b/clang-tidy/bugprone/CMakeLists.txt
index 1c8b9b46..9d52852d 100644
--- a/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tidy/bugprone/CMakeLists.txt
@@ -34,6 +34,7 @@ add_clang_library(clangTidyBugproneModule
ThrowKeywordMissingCheck.cpp
UndefinedMemoryManipulationCheck.cpp
UndelegatedConstructorCheck.cpp
+ UnusedRaiiCheck.cpp
UseAfterMoveCheck.cpp
VirtualNearMissCheck.cpp
diff --git a/clang-tidy/misc/UnusedRAIICheck.cpp b/clang-tidy/bugprone/UnusedRaiiCheck.cpp
index e1acfe97..e2882f37 100644
--- a/clang-tidy/misc/UnusedRAIICheck.cpp
+++ b/clang-tidy/bugprone/UnusedRaiiCheck.cpp
@@ -1,4 +1,4 @@
-//===--- UnusedRAIICheck.cpp - clang-tidy ---------------------------------===//
+//===--- UnusedRaiiCheck.cpp - clang-tidy ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "UnusedRAIICheck.h"
+#include "UnusedRaiiCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/Lex/Lexer.h"
@@ -15,7 +15,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
-namespace misc {
+namespace bugprone {
namespace {
AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) {
@@ -24,7 +24,7 @@ AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) {
}
} // namespace
-void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) {
+void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
@@ -47,7 +47,7 @@ void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) {
this);
}
-void UnusedRAIICheck::check(const MatchFinder::MatchResult &Result) {
+void UnusedRaiiCheck::check(const MatchFinder::MatchResult &Result) {
const auto *E = Result.Nodes.getNodeAs<Expr>("expr");
// We ignore code expanded from macros to reduce the number of false
@@ -89,6 +89,6 @@ void UnusedRAIICheck::check(const MatchFinder::MatchResult &Result) {
Replacement);
}
-} // namespace misc
+} // namespace bugprone
} // namespace tidy
} // namespace clang
diff --git a/clang-tidy/misc/UnusedRAIICheck.h b/clang-tidy/bugprone/UnusedRaiiCheck.h
index 40f44e3d..34190ece 100644
--- a/clang-tidy/misc/UnusedRAIICheck.h
+++ b/clang-tidy/bugprone/UnusedRaiiCheck.h
@@ -1,4 +1,4 @@
-//===--- UnusedRAIICheck.h - clang-tidy -------------------------*- C++ -*-===//
+//===--- UnusedRaiiCheck.h - clang-tidy -------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,29 +7,29 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H
#include "../ClangTidy.h"
namespace clang {
namespace tidy {
-namespace misc {
+namespace bugprone {
/// Finds temporaries that look like RAII objects.
///
/// For the user-facing documentation see:
-/// http://clang.llvm.org/extra/clang-tidy/checks/misc-unused-raii.html
-class UnusedRAIICheck : public ClangTidyCheck {
+/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html
+class UnusedRaiiCheck : public ClangTidyCheck {
public:
- UnusedRAIICheck(StringRef Name, ClangTidyContext *Context)
+ UnusedRaiiCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
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_UNUSEDRAIICHECK_H
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H
diff --git a/clang-tidy/misc/CMakeLists.txt b/clang-tidy/misc/CMakeLists.txt
index e81a528f..3806398e 100644
--- a/clang-tidy/misc/CMakeLists.txt
+++ b/clang-tidy/misc/CMakeLists.txt
@@ -13,7 +13,6 @@ add_clang_library(clangTidyMiscModule
UniqueptrResetReleaseCheck.cpp
UnusedAliasDeclsCheck.cpp
UnusedParametersCheck.cpp
- UnusedRAIICheck.cpp
UnusedUsingDeclsCheck.cpp
LINK_LIBS
diff --git a/clang-tidy/misc/MiscTidyModule.cpp b/clang-tidy/misc/MiscTidyModule.cpp
index b49f7947..241689a2 100644
--- a/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tidy/misc/MiscTidyModule.cpp
@@ -21,7 +21,6 @@
#include "UniqueptrResetReleaseCheck.h"
#include "UnusedAliasDeclsCheck.h"
#include "UnusedParametersCheck.h"
-#include "UnusedRAIICheck.h"
#include "UnusedUsingDeclsCheck.h"
namespace clang {
@@ -51,7 +50,6 @@ public:
"misc-unused-alias-decls");
CheckFactories.registerCheck<UnusedParametersCheck>(
"misc-unused-parameters");
- CheckFactories.registerCheck<UnusedRAIICheck>("misc-unused-raii");
CheckFactories.registerCheck<UnusedUsingDeclsCheck>(
"misc-unused-using-decls");
}
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index ffb3c45a..bcb4c044 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -114,6 +114,11 @@ Improvements to clang-tidy
Warns or suggests alternatives if SIMD intrinsics are used which can be replaced by
``std::experimental::simd`` operations.
+- New `zircon-temporary-objects
+ <http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html>`_ check
+
+ Warns on construction of specific temporary objects in the Zircon kernel.
+
- New alias `hicpp-avoid-goto
<http://clang.llvm.org/extra/clang-tidy/checks/hicpp-avoid-goto.html>`_ to
`cppcoreguidelines-avoid-goto <http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-avoid-goto.html>`_
@@ -170,10 +175,8 @@ Improvements to clang-tidy
- The 'misc-undelegated-constructor' check was renamed to `bugprone-undelegated-constructor
<http://clang.llvm.org/extra/clang-tidy/checks/bugprone-undelegated-constructor.html>`_
-- New `zircon-temporary-objects
- <http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html>`_ check
-
- Warns on construction of specific temporary objects in the Zircon kernel.
+- The 'misc-unused-raii' check was renamed to `bugprone-unused-raii
+ <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html>`_
Improvements to include-fixer
-----------------------------
diff --git a/docs/clang-tidy/checks/misc-unused-raii.rst b/docs/clang-tidy/checks/bugprone-unused-raii.rst
index d081702b..f1987c53 100644
--- a/docs/clang-tidy/checks/misc-unused-raii.rst
+++ b/docs/clang-tidy/checks/bugprone-unused-raii.rst
@@ -1,7 +1,7 @@
-.. title:: clang-tidy - misc-unused-raii
+.. title:: clang-tidy - bugprone-unused-raii
-misc-unused-raii
-================
+bugprone-unused-raii
+====================
Finds temporaries that look like RAII objects.
diff --git a/docs/clang-tidy/checks/list.rst b/docs/clang-tidy/checks/list.rst
index 9194d627..62ecbb68 100644
--- a/docs/clang-tidy/checks/list.rst
+++ b/docs/clang-tidy/checks/list.rst
@@ -50,6 +50,7 @@ Clang-Tidy Checks
bugprone-throw-keyword-missing
bugprone-undefined-memory-manipulation
bugprone-undelegated-constructor
+ bugprone-unused-raii
bugprone-use-after-move
bugprone-virtual-near-miss
cert-dcl03-c (redirects to misc-static-assert) <cert-dcl03-c>
@@ -153,7 +154,6 @@ Clang-Tidy Checks
misc-uniqueptr-reset-release
misc-unused-alias-decls
misc-unused-parameters
- misc-unused-raii
misc-unused-using-decls
modernize-avoid-bind
modernize-deprecated-headers
diff --git a/test/clang-tidy/misc-unused-raii.cpp b/test/clang-tidy/bugprone-unused-raii.cpp
index f22746c0..91ade524 100644
--- a/test/clang-tidy/misc-unused-raii.cpp
+++ b/test/clang-tidy/bugprone-unused-raii.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s misc-unused-raii %t
+// RUN: %check_clang_tidy %s bugprone-unused-raii %t
struct Foo {
Foo();