[clang-tidy] rename_check.py misc-dangling-handle bugprone-dangling-handle

Reviewers: hokein

Reviewed By: hokein

Subscribers: mgorny, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D40389

llvm-svn: 318941
This commit is contained in:
Alexander Kornienko 2017-11-24 09:52:05 +00:00
parent 80e4be7eae
commit 4b9ee769ca
10 changed files with 22 additions and 18 deletions

View File

@ -12,6 +12,7 @@
#include "../ClangTidyModuleRegistry.h" #include "../ClangTidyModuleRegistry.h"
#include "ArgumentCommentCheck.h" #include "ArgumentCommentCheck.h"
#include "CopyConstructorInitCheck.h" #include "CopyConstructorInitCheck.h"
#include "DanglingHandleCheck.h"
#include "IntegerDivisionCheck.h" #include "IntegerDivisionCheck.h"
#include "MisplacedOperatorInStrlenInAllocCheck.h" #include "MisplacedOperatorInStrlenInAllocCheck.h"
#include "StringConstructorCheck.h" #include "StringConstructorCheck.h"
@ -29,6 +30,8 @@ public:
"bugprone-argument-comment"); "bugprone-argument-comment");
CheckFactories.registerCheck<CopyConstructorInitCheck>( CheckFactories.registerCheck<CopyConstructorInitCheck>(
"bugprone-copy-constructor-init"); "bugprone-copy-constructor-init");
CheckFactories.registerCheck<DanglingHandleCheck>(
"bugprone-dangling-handle");
CheckFactories.registerCheck<IntegerDivisionCheck>( CheckFactories.registerCheck<IntegerDivisionCheck>(
"bugprone-integer-division"); "bugprone-integer-division");
CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>( CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>(

View File

@ -4,6 +4,7 @@ add_clang_library(clangTidyBugproneModule
ArgumentCommentCheck.cpp ArgumentCommentCheck.cpp
BugproneTidyModule.cpp BugproneTidyModule.cpp
CopyConstructorInitCheck.cpp CopyConstructorInitCheck.cpp
DanglingHandleCheck.cpp
IntegerDivisionCheck.cpp IntegerDivisionCheck.cpp
MisplacedOperatorInStrlenInAllocCheck.cpp MisplacedOperatorInStrlenInAllocCheck.cpp
StringConstructorCheck.cpp StringConstructorCheck.cpp

View File

@ -18,7 +18,7 @@ using namespace clang::tidy::matchers;
namespace clang { namespace clang {
namespace tidy { namespace tidy {
namespace misc { namespace bugprone {
namespace { namespace {
@ -179,6 +179,6 @@ void DanglingHandleCheck::check(const MatchFinder::MatchResult &Result) {
<< Handle->getQualifiedNameAsString(); << Handle->getQualifiedNameAsString();
} }
} // namespace misc } // namespace bugprone
} // namespace tidy } // namespace tidy
} // namespace clang } // namespace clang

View File

@ -7,20 +7,20 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_DANGLING_HANDLE_H #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DANGLING_HANDLE_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_DANGLING_HANDLE_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DANGLING_HANDLE_H
#include "../ClangTidy.h" #include "../ClangTidy.h"
namespace clang { namespace clang {
namespace tidy { namespace tidy {
namespace misc { namespace bugprone {
/// Detect dangling references in value handlers like /// Detect dangling references in value handlers like
/// std::experimental::string_view. /// std::experimental::string_view.
/// ///
/// For the user-facing documentation see: /// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/misc-dangling-handle.html /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-dangling-handle.html
class DanglingHandleCheck : public ClangTidyCheck { class DanglingHandleCheck : public ClangTidyCheck {
public: public:
DanglingHandleCheck(StringRef Name, ClangTidyContext *Context); DanglingHandleCheck(StringRef Name, ClangTidyContext *Context);
@ -36,8 +36,8 @@ private:
const ast_matchers::internal::Matcher<RecordDecl> IsAHandle; const ast_matchers::internal::Matcher<RecordDecl> IsAHandle;
}; };
} // namespace misc } // namespace bugprone
} // namespace tidy } // namespace tidy
} // namespace clang } // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_DANGLING_HANDLE_H #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DANGLING_HANDLE_H

View File

@ -7,7 +7,6 @@ add_clang_library(clangTidyMiscModule
MisplacedConstCheck.cpp MisplacedConstCheck.cpp
UnconventionalAssignOperatorCheck.cpp UnconventionalAssignOperatorCheck.cpp
BoolPointerImplicitConversionCheck.cpp BoolPointerImplicitConversionCheck.cpp
DanglingHandleCheck.cpp
DefinitionsInHeadersCheck.cpp DefinitionsInHeadersCheck.cpp
FoldInitTypeCheck.cpp FoldInitTypeCheck.cpp
ForwardDeclarationNamespaceCheck.cpp ForwardDeclarationNamespaceCheck.cpp

View File

@ -12,7 +12,6 @@
#include "../ClangTidyModuleRegistry.h" #include "../ClangTidyModuleRegistry.h"
#include "AssertSideEffectCheck.h" #include "AssertSideEffectCheck.h"
#include "BoolPointerImplicitConversionCheck.h" #include "BoolPointerImplicitConversionCheck.h"
#include "DanglingHandleCheck.h"
#include "DefinitionsInHeadersCheck.h" #include "DefinitionsInHeadersCheck.h"
#include "FoldInitTypeCheck.h" #include "FoldInitTypeCheck.h"
#include "ForwardDeclarationNamespaceCheck.h" #include "ForwardDeclarationNamespaceCheck.h"
@ -73,7 +72,6 @@ public:
"misc-unconventional-assign-operator"); "misc-unconventional-assign-operator");
CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>( CheckFactories.registerCheck<BoolPointerImplicitConversionCheck>(
"misc-bool-pointer-implicit-conversion"); "misc-bool-pointer-implicit-conversion");
CheckFactories.registerCheck<DanglingHandleCheck>("misc-dangling-handle");
CheckFactories.registerCheck<DefinitionsInHeadersCheck>( CheckFactories.registerCheck<DefinitionsInHeadersCheck>(
"misc-definitions-in-headers"); "misc-definitions-in-headers");
CheckFactories.registerCheck<FoldInitTypeCheck>("misc-fold-init-type"); CheckFactories.registerCheck<FoldInitTypeCheck>("misc-fold-init-type");

View File

@ -57,6 +57,9 @@ The improvements are...
Improvements to clang-tidy Improvements to clang-tidy
-------------------------- --------------------------
- The 'misc-dangling-handle' check was renamed to `bugprone-dangling-handle
<http://clang.llvm.org/extra/clang-tidy/checks/bugprone-dangling-handle.html>`_
- The 'misc-argument-comment' check was renamed to `bugprone-argument-comment - The 'misc-argument-comment' check was renamed to `bugprone-argument-comment
<http://clang.llvm.org/extra/clang-tidy/checks/bugprone-argument-comment.html>`_ <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-argument-comment.html>`_

View File

@ -1,7 +1,7 @@
.. title:: clang-tidy - misc-dangling-handle .. title:: clang-tidy - bugprone-dangling-handle
misc-dangling-handle bugprone-dangling-handle
==================== ========================
Detect dangling references in value handles like Detect dangling references in value handles like
``std::experimental::string_view``. ``std::experimental::string_view``.

View File

@ -19,6 +19,7 @@ Clang-Tidy Checks
boost-use-to-string boost-use-to-string
bugprone-argument-comment bugprone-argument-comment
bugprone-copy-constructor-init bugprone-copy-constructor-init
bugprone-dangling-handle
bugprone-integer-division bugprone-integer-division
bugprone-misplaced-operator-in-strlen-in-alloc bugprone-misplaced-operator-in-strlen-in-alloc
bugprone-string-constructor bugprone-string-constructor
@ -108,7 +109,6 @@ Clang-Tidy Checks
llvm-twine-local llvm-twine-local
misc-assert-side-effect misc-assert-side-effect
misc-bool-pointer-implicit-conversion misc-bool-pointer-implicit-conversion
misc-dangling-handle
misc-definitions-in-headers misc-definitions-in-headers
misc-fold-init-type misc-fold-init-type
misc-forward-declaration-namespace misc-forward-declaration-namespace

View File

@ -1,6 +1,6 @@
// RUN: %check_clang_tidy %s misc-dangling-handle %t -- \ // RUN: %check_clang_tidy %s bugprone-dangling-handle %t -- \
// RUN: -config="{CheckOptions: \ // RUN: -config="{CheckOptions: \
// RUN: [{key: misc-dangling-handle.HandleClasses, \ // RUN: [{key: bugprone-dangling-handle.HandleClasses, \
// RUN: value: 'std::basic_string_view; ::llvm::StringRef;'}]}" \ // RUN: value: 'std::basic_string_view; ::llvm::StringRef;'}]}" \
// RUN: -- -std=c++11 // RUN: -- -std=c++11
@ -79,7 +79,7 @@ std::string ReturnsAString();
void Positives() { void Positives() {
std::string_view view1 = std::string(); std::string_view view1 = std::string();
// CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives its value [misc-dangling-handle] // CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives its value [bugprone-dangling-handle]
std::string_view view_2 = ReturnsAString(); std::string_view view_2 = ReturnsAString();
// CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives // CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives