[clang-tidy] rename_check.py misc-string-constructor bugprone-string-constructor

Summary:
Rename misc-string-constructor to bugprone-string-constructor +
manually update the lenght of '==='s in the doc file.

Reviewers: hokein, xazax.hun

Reviewed By: hokein, xazax.hun

Subscribers: mgorny, xazax.hun, cfe-commits

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

llvm-svn: 318916
This commit is contained in:
Alexander Kornienko 2017-11-23 13:49:14 +00:00
parent c01f7f131b
commit a3251bf24c
10 changed files with 21 additions and 18 deletions

View File

@ -13,6 +13,7 @@
#include "CopyConstructorInitCheck.h"
#include "IntegerDivisionCheck.h"
#include "MisplacedOperatorInStrlenInAllocCheck.h"
#include "StringConstructorCheck.h"
#include "SuspiciousMemsetUsageCheck.h"
#include "UndefinedMemoryManipulationCheck.h"
@ -29,6 +30,8 @@ public:
"bugprone-integer-division");
CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>(
"bugprone-misplaced-operator-in-strlen-in-alloc");
CheckFactories.registerCheck<StringConstructorCheck>(
"bugprone-string-constructor");
CheckFactories.registerCheck<SuspiciousMemsetUsageCheck>(
"bugprone-suspicious-memset-usage");
CheckFactories.registerCheck<UndefinedMemoryManipulationCheck>(

View File

@ -5,6 +5,7 @@ add_clang_library(clangTidyBugproneModule
CopyConstructorInitCheck.cpp
IntegerDivisionCheck.cpp
MisplacedOperatorInStrlenInAllocCheck.cpp
StringConstructorCheck.cpp
SuspiciousMemsetUsageCheck.cpp
UndefinedMemoryManipulationCheck.cpp

View File

@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace misc {
namespace bugprone {
AST_MATCHER_P(IntegerLiteral, isBiggerThan, unsigned, N) {
return Node.getValue().getZExtValue() > N;
@ -129,6 +129,6 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) {
}
}
} // namespace misc
} // namespace bugprone
} // namespace tidy
} // namespace clang

View File

@ -7,19 +7,19 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STRING_CONSTRUCTOR_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STRING_CONSTRUCTOR_H
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_STRING_CONSTRUCTOR_H
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_STRING_CONSTRUCTOR_H
#include "../ClangTidy.h"
namespace clang {
namespace tidy {
namespace misc {
namespace bugprone {
/// Finds suspicious string constructor and check their parameters.
///
/// For the user-facing documentation see:
/// http://clang.llvm.org/extra/clang-tidy/checks/misc-string-constructor.html
/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-constructor.html
class StringConstructorCheck : public ClangTidyCheck {
public:
StringConstructorCheck(StringRef Name, ClangTidyContext *Context);
@ -32,8 +32,8 @@ private:
const unsigned int LargeLengthThreshold;
};
} // namespace misc
} // namespace bugprone
} // namespace tidy
} // namespace clang
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STRING_CONSTRUCTOR_H
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_STRING_CONSTRUCTOR_H

View File

@ -31,7 +31,6 @@ add_clang_library(clangTidyMiscModule
SizeofExpressionCheck.cpp
StaticAssertCheck.cpp
StringCompareCheck.cpp
StringConstructorCheck.cpp
StringIntegerAssignmentCheck.cpp
StringLiteralWithEmbeddedNulCheck.cpp
SuspiciousEnumUsageCheck.cpp

View File

@ -38,7 +38,6 @@
#include "SizeofExpressionCheck.h"
#include "StaticAssertCheck.h"
#include "StringCompareCheck.h"
#include "StringConstructorCheck.h"
#include "StringIntegerAssignmentCheck.h"
#include "StringLiteralWithEmbeddedNulCheck.h"
#include "SuspiciousEnumUsageCheck.h"
@ -114,8 +113,6 @@ public:
"misc-sizeof-expression");
CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
CheckFactories.registerCheck<StringCompareCheck>("misc-string-compare");
CheckFactories.registerCheck<StringConstructorCheck>(
"misc-string-constructor");
CheckFactories.registerCheck<StringIntegerAssignmentCheck>(
"misc-string-integer-assignment");
CheckFactories.registerCheck<StringLiteralWithEmbeddedNulCheck>(

View File

@ -57,6 +57,9 @@ The improvements are...
Improvements to clang-tidy
--------------------------
- The 'misc-string-constructor' check was renamed to `bugprone-string-constructor
<http://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-constructor.html>`_
- New `google-avoid-throwing-objc-exception
<http://clang.llvm.org/extra/clang-tidy/checks/google-objc-avoid-throwing-exception.html>`_ check

View File

@ -1,7 +1,7 @@
.. title:: clang-tidy - misc-string-constructor
.. title:: clang-tidy - bugprone-string-constructor
misc-string-constructor
=======================
bugprone-string-constructor
===========================
Finds string constructors that are suspicious and probably errors.

View File

@ -20,6 +20,7 @@ Clang-Tidy Checks
bugprone-copy-constructor-init
bugprone-integer-division
bugprone-misplaced-operator-in-strlen-in-alloc
bugprone-string-constructor
bugprone-suspicious-memset-usage
bugprone-undefined-memory-manipulation
cert-dcl03-c (redirects to misc-static-assert) <cert-dcl03-c>
@ -132,7 +133,6 @@ Clang-Tidy Checks
misc-sizeof-expression
misc-static-assert
misc-string-compare
misc-string-constructor
misc-string-integer-assignment
misc-string-literal-with-embedded-nul
misc-suspicious-enum-usage

View File

@ -1,4 +1,4 @@
// RUN: %check_clang_tidy %s misc-string-constructor %t
// RUN: %check_clang_tidy %s bugprone-string-constructor %t
namespace std {
template <typename T>
@ -21,7 +21,7 @@ extern const char kText3[];
void Test() {
std::string str('x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: string constructor parameters are probably swapped; expecting string(count, character) [misc-string-constructor]
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: string constructor parameters are probably swapped; expecting string(count, character) [bugprone-string-constructor]
// CHECK-FIXES: std::string str(4, 'x');
std::wstring wstr(L'x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:16: warning: string constructor parameters are probably swapped