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

View File

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

View File

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

View File

@ -7,20 +7,20 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_DANGLING_HANDLE_H
#define 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_BUGPRONE_DANGLING_HANDLE_H
#include "../ClangTidy.h"
namespace clang {
namespace tidy {
namespace misc {
namespace bugprone {
/// Detect dangling references in value handlers like
/// std::experimental::string_view.
///
/// 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 {
public:
DanglingHandleCheck(StringRef Name, ClangTidyContext *Context);
@ -36,8 +36,8 @@ private:
const ast_matchers::internal::Matcher<RecordDecl> IsAHandle;
};
} // namespace misc
} // namespace bugprone
} // namespace tidy
} // 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
UnconventionalAssignOperatorCheck.cpp
BoolPointerImplicitConversionCheck.cpp
DanglingHandleCheck.cpp
DefinitionsInHeadersCheck.cpp
FoldInitTypeCheck.cpp
ForwardDeclarationNamespaceCheck.cpp

View File

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

View File

@ -57,6 +57,9 @@ The improvements are...
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
<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
``std::experimental::string_view``.

View File

@ -19,6 +19,7 @@ Clang-Tidy Checks
boost-use-to-string
bugprone-argument-comment
bugprone-copy-constructor-init
bugprone-dangling-handle
bugprone-integer-division
bugprone-misplaced-operator-in-strlen-in-alloc
bugprone-string-constructor
@ -108,7 +109,6 @@ Clang-Tidy Checks
llvm-twine-local
misc-assert-side-effect
misc-bool-pointer-implicit-conversion
misc-dangling-handle
misc-definitions-in-headers
misc-fold-init-type
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: [{key: misc-dangling-handle.HandleClasses, \
// RUN: [{key: bugprone-dangling-handle.HandleClasses, \
// RUN: value: 'std::basic_string_view; ::llvm::StringRef;'}]}" \
// RUN: -- -std=c++11
@ -79,7 +79,7 @@ std::string ReturnsAString();
void Positives() {
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();
// CHECK-MESSAGES: [[@LINE-1]]:20: warning: std::basic_string_view outlives