forked from OSchip/llvm-project
[clang-tidy] rename_check.py misc-sizeof-expression bugprone-sizeof-expression
llvm-svn: 327607
This commit is contained in:
parent
7ff6076129
commit
3273888536
|
@ -28,6 +28,7 @@
|
|||
#include "MisplacedWideningCastCheck.h"
|
||||
#include "MoveForwardingReferenceCheck.h"
|
||||
#include "MultipleStatementMacroCheck.h"
|
||||
#include "SizeofExpressionCheck.h"
|
||||
#include "StringConstructorCheck.h"
|
||||
#include "StringIntegerAssignmentCheck.h"
|
||||
#include "StringLiteralWithEmbeddedNulCheck.h"
|
||||
|
@ -86,6 +87,8 @@ public:
|
|||
"bugprone-move-forwarding-reference");
|
||||
CheckFactories.registerCheck<MultipleStatementMacroCheck>(
|
||||
"bugprone-multiple-statement-macro");
|
||||
CheckFactories.registerCheck<SizeofExpressionCheck>(
|
||||
"bugprone-sizeof-expression");
|
||||
CheckFactories.registerCheck<StringConstructorCheck>(
|
||||
"bugprone-string-constructor");
|
||||
CheckFactories.registerCheck<StringIntegerAssignmentCheck>(
|
||||
|
|
|
@ -20,6 +20,7 @@ add_clang_library(clangTidyBugproneModule
|
|||
MisplacedWideningCastCheck.cpp
|
||||
MoveForwardingReferenceCheck.cpp
|
||||
MultipleStatementMacroCheck.cpp
|
||||
SizeofExpressionCheck.cpp
|
||||
StringConstructorCheck.cpp
|
||||
StringIntegerAssignmentCheck.cpp
|
||||
StringLiteralWithEmbeddedNulCheck.cpp
|
||||
|
|
|
@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
|
|||
|
||||
namespace clang {
|
||||
namespace tidy {
|
||||
namespace misc {
|
||||
namespace bugprone {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -260,6 +260,6 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace misc
|
||||
} // namespace bugprone
|
||||
} // namespace tidy
|
||||
} // namespace clang
|
|
@ -7,19 +7,19 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_EXPRESSION_H
|
||||
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_EXPRESSION_H
|
||||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFEXPRESSIONCHECK_H
|
||||
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFEXPRESSIONCHECK_H
|
||||
|
||||
#include "../ClangTidy.h"
|
||||
|
||||
namespace clang {
|
||||
namespace tidy {
|
||||
namespace misc {
|
||||
namespace bugprone {
|
||||
|
||||
/// Find suspicious usages of sizeof expression.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/misc-sizeof-expression.html
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-expression.html
|
||||
class SizeofExpressionCheck : public ClangTidyCheck {
|
||||
public:
|
||||
SizeofExpressionCheck(StringRef Name, ClangTidyContext *Context);
|
||||
|
@ -33,8 +33,8 @@ private:
|
|||
const bool WarnOnSizeOfCompareToConstant;
|
||||
};
|
||||
|
||||
} // namespace misc
|
||||
} // namespace bugprone
|
||||
} // namespace tidy
|
||||
} // namespace clang
|
||||
|
||||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_SIZEOF_EXPRESSION_H
|
||||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_SIZEOFEXPRESSIONCHECK_H
|
|
@ -9,7 +9,6 @@ add_clang_library(clangTidyMiscModule
|
|||
NonCopyableObjects.cpp
|
||||
RedundantExpressionCheck.cpp
|
||||
SizeofContainerCheck.cpp
|
||||
SizeofExpressionCheck.cpp
|
||||
StaticAssertCheck.cpp
|
||||
ThrowByValueCatchByReferenceCheck.cpp
|
||||
UniqueptrResetReleaseCheck.cpp
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "NonCopyableObjects.h"
|
||||
#include "RedundantExpressionCheck.h"
|
||||
#include "SizeofContainerCheck.h"
|
||||
#include "SizeofExpressionCheck.h"
|
||||
#include "StaticAssertCheck.h"
|
||||
#include "ThrowByValueCatchByReferenceCheck.h"
|
||||
#include "UnconventionalAssignOperatorCheck.h"
|
||||
|
@ -45,8 +44,6 @@ public:
|
|||
CheckFactories.registerCheck<RedundantExpressionCheck>(
|
||||
"misc-redundant-expression");
|
||||
CheckFactories.registerCheck<SizeofContainerCheck>("misc-sizeof-container");
|
||||
CheckFactories.registerCheck<SizeofExpressionCheck>(
|
||||
"misc-sizeof-expression");
|
||||
CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
|
||||
CheckFactories.registerCheck<ThrowByValueCatchByReferenceCheck>(
|
||||
"misc-throw-by-value-catch-by-reference");
|
||||
|
|
|
@ -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-expression' check was renamed to `bugprone-sizeof-expression
|
||||
<http://clang.llvm.org/extra/clang-tidy/checks/bugprone-sizeof-expression.html>`_
|
||||
|
||||
- The 'misc-string-compare' check was renamed to `readability-string-compare
|
||||
<http://clang.llvm.org/extra/clang-tidy/checks/readability-string-compare.html>`_
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. title:: clang-tidy - misc-sizeof-expression
|
||||
.. title:: clang-tidy - bugprone-sizeof-expression
|
||||
|
||||
misc-sizeof-expression
|
||||
======================
|
||||
bugprone-sizeof-expression
|
||||
==========================
|
||||
|
||||
The check finds usages of ``sizeof`` expressions which are most likely errors.
|
||||
|
|
@ -36,6 +36,7 @@ Clang-Tidy Checks
|
|||
bugprone-misplaced-widening-cast
|
||||
bugprone-move-forwarding-reference
|
||||
bugprone-multiple-statement-macro
|
||||
bugprone-sizeof-expression
|
||||
bugprone-string-constructor
|
||||
bugprone-string-integer-assignment
|
||||
bugprone-string-literal-with-embedded-nul
|
||||
|
@ -146,7 +147,6 @@ Clang-Tidy Checks
|
|||
misc-non-copyable-objects
|
||||
misc-redundant-expression
|
||||
misc-sizeof-container
|
||||
misc-sizeof-expression
|
||||
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-expression %t
|
||||
// RUN: %check_clang_tidy %s bugprone-sizeof-expression %t
|
||||
|
||||
class C {
|
||||
int size() { return sizeof(this); }
|
Loading…
Reference in New Issue