diff options
author | Alexander Kornienko <alexfh@google.com> | 2018-02-28 14:47:20 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2018-02-28 14:47:20 +0000 |
commit | a1a29336340080d33893f82d5bf369df11615d58 (patch) | |
tree | 201f199921c8ee58b8abe9665390d829128af9f8 /clang-tools-extra | |
parent | 7e4eee98311dcecc782a93265e62934570e096c1 (diff) | |
download | bcm5719-llvm-a1a29336340080d33893f82d5bf369df11615d58.tar.gz bcm5719-llvm-a1a29336340080d33893f82d5bf369df11615d58.zip |
Rename a few checks from misc- to bugprone-.
Summary:
rename_check.py {misc,bugprone}-forwarding-reference-overload
rename_check.py {misc,bugprone}-macro-repeated-side-effects
rename_check.py {misc,bugprone}-lambda-function-name
rename_check.py {misc,bugprone}-misplaced-widening-cast
Reviewers: hokein, sammccall, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: klimek, cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D43867
llvm-svn: 326327
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp | 12 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp (renamed from clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.h (renamed from clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.h) | 12 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp (renamed from clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.h (renamed from clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.h) | 12 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp (renamed from clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h (renamed from clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.h) | 10 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp (renamed from clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.h (renamed from clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.h) | 10 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/CMakeLists.txt | 4 | ||||
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | 12 | ||||
-rw-r--r-- | clang-tools-extra/docs/ReleaseNotes.rst | 12 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst (renamed from clang-tools-extra/docs/clang-tidy/checks/misc-forwarding-reference-overload.rst) | 6 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst (renamed from clang-tools-extra/docs/clang-tidy/checks/misc-lambda-function-name.rst) | 6 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-repeated-side-effects.rst | 7 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/bugprone-misplaced-widening-cast.rst (renamed from clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst) | 6 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 8 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst | 7 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/bugprone-forwarding-reference-overload.cpp (renamed from clang-tools-extra/test/clang-tidy/misc-forwarding-reference-overload.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/bugprone-lambda-function-name.cpp (renamed from clang-tools-extra/test/clang-tidy/misc-lambda-function-name.cpp) | 12 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/bugprone-macro-repeated-side-effects.c (renamed from clang-tools-extra/test/clang-tidy/misc-macro-repeated-side-effects.c) | 4 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp (renamed from clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp) | 4 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-implicit-enabled.cpp (renamed from clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp) | 4 |
24 files changed, 92 insertions, 80 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp index 68effd14c88..5e67672fa53 100644 --- a/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp @@ -17,10 +17,14 @@ #include "DanglingHandleCheck.h" #include "FoldInitTypeCheck.h" #include "ForwardDeclarationNamespaceCheck.h" +#include "ForwardingReferenceOverloadCheck.h" #include "InaccurateEraseCheck.h" #include "IncorrectRoundingsCheck.h" #include "IntegerDivisionCheck.h" +#include "LambdaFunctionNameCheck.h" +#include "MacroRepeatedSideEffectsCheck.h" #include "MisplacedOperatorInStrlenInAllocCheck.h" +#include "MisplacedWideningCastCheck.h" #include "MoveForwardingReferenceCheck.h" #include "MultipleStatementMacroCheck.h" #include "StringConstructorCheck.h" @@ -51,14 +55,22 @@ public: "bugprone-fold-init-type"); CheckFactories.registerCheck<ForwardDeclarationNamespaceCheck>( "bugprone-forward-declaration-namespace"); + CheckFactories.registerCheck<ForwardingReferenceOverloadCheck>( + "bugprone-forwarding-reference-overload"); CheckFactories.registerCheck<InaccurateEraseCheck>( "bugprone-inaccurate-erase"); CheckFactories.registerCheck<IncorrectRoundingsCheck>( "bugprone-incorrect-roundings"); CheckFactories.registerCheck<IntegerDivisionCheck>( "bugprone-integer-division"); + CheckFactories.registerCheck<LambdaFunctionNameCheck>( + "bugprone-lambda-function-name"); + CheckFactories.registerCheck<MacroRepeatedSideEffectsCheck>( + "bugprone-macro-repeated-side-effects"); CheckFactories.registerCheck<MisplacedOperatorInStrlenInAllocCheck>( "bugprone-misplaced-operator-in-strlen-in-alloc"); + CheckFactories.registerCheck<MisplacedWideningCastCheck>( + "bugprone-misplaced-widening-cast"); CheckFactories.registerCheck<MoveForwardingReferenceCheck>( "bugprone-move-forwarding-reference"); CheckFactories.registerCheck<MultipleStatementMacroCheck>( diff --git a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt index 54d93ef2de1..73b4e55f589 100644 --- a/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt @@ -9,10 +9,14 @@ add_clang_library(clangTidyBugproneModule DanglingHandleCheck.cpp FoldInitTypeCheck.cpp ForwardDeclarationNamespaceCheck.cpp + ForwardingReferenceOverloadCheck.cpp InaccurateEraseCheck.cpp IncorrectRoundingsCheck.cpp IntegerDivisionCheck.cpp + LambdaFunctionNameCheck.cpp + MacroRepeatedSideEffectsCheck.cpp MisplacedOperatorInStrlenInAllocCheck.cpp + MisplacedWideningCastCheck.cpp MoveForwardingReferenceCheck.cpp MultipleStatementMacroCheck.cpp StringConstructorCheck.cpp diff --git a/clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp index 3da5a0998da..17bdc76c958 100644 --- a/clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp @@ -16,7 +16,7 @@ using namespace clang::ast_matchers; namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { // Check if the given type is related to std::enable_if. @@ -143,6 +143,6 @@ void ForwardingReferenceOverloadCheck::check( } } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.h b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.h index ffdf0e84fa8..4b00ab293b7 100644 --- a/clang-tools-extra/clang-tidy/misc/ForwardingReferenceOverloadCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.h @@ -7,14 +7,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_FORWARDING_REFERENCE_OVERLOAD_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_FORWARDING_REFERENCE_OVERLOAD_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_FORWARDINGREFERENCEOVERLOADCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_FORWARDINGREFERENCEOVERLOADCHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { -namespace misc { +namespace bugprone { /// The checker looks for constructors that can act as copy or move constructors /// through their forwarding reference parameters. If a non const lvalue @@ -26,7 +26,7 @@ namespace misc { /// C++ Design, item 26. /// /// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-forwarding-reference-overload.html +/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-forwarding-reference-overload.html class ForwardingReferenceOverloadCheck : public ClangTidyCheck { public: ForwardingReferenceOverloadCheck(StringRef Name, ClangTidyContext *Context) @@ -35,8 +35,8 @@ public: 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_FORWARDING_REFERENCE_OVERLOAD_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_FORWARDINGREFERENCEOVERLOADCHECK_H diff --git a/clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp index 85dad5c4fd4..60eb245c65d 100644 --- a/clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp @@ -18,7 +18,7 @@ using namespace clang::ast_matchers; namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { @@ -94,6 +94,6 @@ void LambdaFunctionNameCheck::check(const MatchFinder::MatchResult &Result) { << PredefinedExpr::getIdentTypeName(E->getIdentType()); } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.h b/clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.h index bd23b00fcc9..b7b1b441773 100644 --- a/clang-tools-extra/clang-tidy/misc/LambdaFunctionNameCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/LambdaFunctionNameCheck.h @@ -7,21 +7,21 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_LAMBDA_FUNCTION_NAME_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_LAMBDA_FUNCTION_NAME_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_LAMBDAFUNCTIONNAMECHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_LAMBDAFUNCTIONNAMECHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { -namespace misc { +namespace bugprone { /// Detect when __func__ or __FUNCTION__ is being used from within a lambda. In /// that context, those expressions expand to the name of the call operator /// (i.e., `operator()`). /// /// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-lambda-function-name.html +/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-lambda-function-name.html class LambdaFunctionNameCheck : public ClangTidyCheck { public: struct SourceRangeLessThan { @@ -44,8 +44,8 @@ private: SourceRangeSet SuppressMacroExpansions; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_LAMBDA_FUNCTION_NAME_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_LAMBDAFUNCTIONNAMECHECK_H diff --git a/clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp index 1bbed46b3dd..30c770e3440 100644 --- a/clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp @@ -15,7 +15,7 @@ namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { class MacroRepeatedPPCallbacks : public PPCallbacks { @@ -179,6 +179,6 @@ void MacroRepeatedSideEffectsCheck::registerPPCallbacks( *this, Compiler.getPreprocessor())); } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.h b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h index 10ff8427bf3..a2a3134144f 100644 --- a/clang-tools-extra/clang-tidy/misc/MacroRepeatedSideEffectsCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h @@ -7,14 +7,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_REPEATED_SIDE_EFFECTS_CHECK_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_REPEATED_SIDE_EFFECTS_CHECK_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROREPEATEDSIDEEFFECTSCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROREPEATEDSIDEEFFECTSCHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { -namespace misc { +namespace bugprone { /// Checks for repeated argument with side effects in macros. class MacroRepeatedSideEffectsCheck : public ClangTidyCheck { @@ -24,8 +24,8 @@ public: void registerPPCallbacks(CompilerInstance &Compiler) override; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MACRO_REPEATED_SIDE_EFFECTS_CHECK_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MACROREPEATEDSIDEEFFECTSCHECK_H diff --git a/clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp index 2ba38b3120a..e263366b664 100644 --- a/clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp @@ -16,7 +16,7 @@ using namespace clang::ast_matchers; namespace clang { namespace tidy { -namespace misc { +namespace bugprone { MisplacedWideningCastCheck::MisplacedWideningCastCheck( StringRef Name, ClangTidyContext *Context) @@ -228,6 +228,6 @@ void MisplacedWideningCastCheck::check(const MatchFinder::MatchResult &Result) { << CalcType << CastType; } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.h b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.h index 1c3bc4a11d9..b61556fdb47 100644 --- a/clang-tools-extra/clang-tidy/misc/MisplacedWideningCastCheck.h +++ b/clang-tools-extra/clang-tidy/bugprone/MisplacedWideningCastCheck.h @@ -7,14 +7,14 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MISPLACED_WIDENING_CAST_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_MISPLACED_WIDENING_CAST_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MISPLACEDWIDENINGCASTCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_MISPLACEDWIDENINGCASTCHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { -namespace misc { +namespace bugprone { /// Find casts of calculation results to bigger type. Typically from int to /// long. If the intention of the cast is to avoid loss of precision then @@ -27,7 +27,7 @@ namespace misc { // be the most common case. Enabled by default. /// /// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-misplaced-widening-cast.html +/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-misplaced-widening-cast.html class MisplacedWideningCastCheck : public ClangTidyCheck { public: MisplacedWideningCastCheck(StringRef Name, ClangTidyContext *Context); @@ -39,7 +39,7 @@ private: const bool CheckImplicitCasts; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt index ecb071f9269..e0e9627f3cb 100644 --- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt @@ -1,15 +1,11 @@ set(LLVM_LINK_COMPONENTS support) add_clang_library(clangTidyMiscModule - ForwardingReferenceOverloadCheck.cpp - LambdaFunctionNameCheck.cpp MisplacedConstCheck.cpp UnconventionalAssignOperatorCheck.cpp DefinitionsInHeadersCheck.cpp MacroParenthesesCheck.cpp - MacroRepeatedSideEffectsCheck.cpp MiscTidyModule.cpp - MisplacedWideningCastCheck.cpp NewDeleteOverloadsCheck.cpp NonCopyableObjects.cpp RedundantExpressionCheck.cpp diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp index 3e25f01d3dd..4ed7c47dec7 100644 --- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp @@ -11,12 +11,8 @@ #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" #include "DefinitionsInHeadersCheck.h" -#include "ForwardingReferenceOverloadCheck.h" -#include "LambdaFunctionNameCheck.h" #include "MacroParenthesesCheck.h" -#include "MacroRepeatedSideEffectsCheck.h" #include "MisplacedConstCheck.h" -#include "MisplacedWideningCastCheck.h" #include "NewDeleteOverloadsCheck.h" #include "NonCopyableObjects.h" #include "RedundantExpressionCheck.h" @@ -46,10 +42,6 @@ namespace misc { class MiscModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { - CheckFactories.registerCheck<ForwardingReferenceOverloadCheck>( - "misc-forwarding-reference-overload"); - CheckFactories.registerCheck<LambdaFunctionNameCheck>( - "misc-lambda-function-name"); CheckFactories.registerCheck<MisplacedConstCheck>("misc-misplaced-const"); CheckFactories.registerCheck<UnconventionalAssignOperatorCheck>( "misc-unconventional-assign-operator"); @@ -57,10 +49,6 @@ public: "misc-definitions-in-headers"); CheckFactories.registerCheck<MacroParenthesesCheck>( "misc-macro-parentheses"); - CheckFactories.registerCheck<MacroRepeatedSideEffectsCheck>( - "misc-macro-repeated-side-effects"); - CheckFactories.registerCheck<MisplacedWideningCastCheck>( - "misc-misplaced-widening-cast"); CheckFactories.registerCheck<NewDeleteOverloadsCheck>( "misc-new-delete-overloads"); CheckFactories.registerCheck<NonCopyableObjectsCheck>( diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index e6d3509043a..0e8ef01340a 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -57,6 +57,18 @@ The improvements are... 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-lambda-function-name' check was renamed to `bugprone-lambda-function-name + <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-lambda-function-name.html>`_ + +- The 'misc-macro-repeated-side-effects' check was renamed to `bugprone-macro-repeated-side-effects + <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-macro-repeated-side-effects.html>`_ + +- The 'misc-forwarding-reference-overload' check was renamed to `bugprone-forwarding-reference-overload + <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-forwarding-reference-overload.html>`_ + - The 'misc-incorrect-roundings' check was renamed to `bugprone-incorrect-roundings <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-incorrect-roundings.html>`_ diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-forwarding-reference-overload.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst index 1682a5fb982..ddf69dca93d 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-forwarding-reference-overload.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst @@ -1,7 +1,7 @@ -.. title:: clang-tidy - misc-forwarding-reference-overload +.. title:: clang-tidy - bugprone-forwarding-reference-overload -misc-forwarding-reference-overload -================================== +bugprone-forwarding-reference-overload +====================================== The check looks for perfect forwarding constructors that can hide copy or move constructors. If a non const lvalue reference is passed to the constructor, the diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-lambda-function-name.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst index 1ab584c1411..683977a3d2c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-lambda-function-name.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst @@ -1,7 +1,7 @@ -.. title:: clang-tidy - misc-lambda-function-name +.. title:: clang-tidy - bugprone-lambda-function-name -misc-lambda-function-name -========================= +bugprone-lambda-function-name +============================= Checks for attempts to get the name of a function from within a lambda expression. The name of a lambda is always something like ``operator()``, which diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-repeated-side-effects.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-repeated-side-effects.rst new file mode 100644 index 00000000000..15dfdcaf6c0 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-macro-repeated-side-effects.rst @@ -0,0 +1,7 @@ +.. title:: clang-tidy - bugprone-macro-repeated-side-effects + +bugprone-macro-repeated-side-effects +==================================== + + +Checks for repeated argument with side effects in macros. diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-misplaced-widening-cast.rst index a2fc2bfdff8..f42be76efaa 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-widening-cast.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-misplaced-widening-cast.rst @@ -1,7 +1,7 @@ -.. title:: clang-tidy - misc-misplaced-widening-cast +.. title:: clang-tidy - bugprone-misplaced-widening-cast -misc-misplaced-widening-cast -============================ +bugprone-misplaced-widening-cast +================================ This check will warn when there is a cast of a calculation result to a bigger type. If the intention of the cast is to avoid loss of precision then the cast diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index f50fd716361..a632f5deb0d 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -24,10 +24,14 @@ Clang-Tidy Checks bugprone-dangling-handle bugprone-fold-init-type bugprone-forward-declaration-namespace + bugprone-forwarding-reference-overload bugprone-inaccurate-erase bugprone-incorrect-roundings bugprone-integer-division + bugprone-lambda-function-name + bugprone-macro-repeated-side-effects bugprone-misplaced-operator-in-strlen-in-alloc + bugprone-misplaced-widening-cast bugprone-move-forwarding-reference bugprone-multiple-statement-macro bugprone-string-constructor @@ -127,12 +131,8 @@ Clang-Tidy Checks llvm-namespace-comment llvm-twine-local misc-definitions-in-headers - misc-forwarding-reference-overload - misc-lambda-function-name misc-macro-parentheses - misc-macro-repeated-side-effects misc-misplaced-const - misc-misplaced-widening-cast misc-new-delete-overloads misc-non-copyable-objects misc-redundant-expression diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst deleted file mode 100644 index 7cd3781eec8..00000000000 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. title:: clang-tidy - misc-macro-repeated-side-effects - -misc-macro-repeated-side-effects -================================ - - -Checks for repeated argument with side effects in macros. diff --git a/clang-tools-extra/test/clang-tidy/misc-forwarding-reference-overload.cpp b/clang-tools-extra/test/clang-tidy/bugprone-forwarding-reference-overload.cpp index a30946662de..35106852fa8 100644 --- a/clang-tools-extra/test/clang-tidy/misc-forwarding-reference-overload.cpp +++ b/clang-tools-extra/test/clang-tidy/bugprone-forwarding-reference-overload.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-forwarding-reference-overload %t -- -- -std=c++14 +// RUN: %check_clang_tidy %s bugprone-forwarding-reference-overload %t -- -- -std=c++14 namespace std { template <bool B, class T = void> struct enable_if { typedef T type; }; @@ -20,7 +20,7 @@ template <typename T> constexpr bool just_true = true; class Test1 { public: template <typename T> Test1(T &&n); - // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [misc-forwarding-reference-overload] + // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload] template <typename T> Test1(T &&n, int i = 5, ...); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors diff --git a/clang-tools-extra/test/clang-tidy/misc-lambda-function-name.cpp b/clang-tools-extra/test/clang-tidy/bugprone-lambda-function-name.cpp index cc5aa2b5a0b..145928b4e20 100644 --- a/clang-tools-extra/test/clang-tidy/misc-lambda-function-name.cpp +++ b/clang-tools-extra/test/clang-tidy/bugprone-lambda-function-name.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-lambda-function-name %t +// RUN: %check_clang_tidy %s bugprone-lambda-function-name %t void Foo(const char* a, const char* b, int c) {} @@ -8,15 +8,15 @@ void Foo(const char* a, const char* b, int c) {} void Positives() { [] { __func__; }(); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [misc-lambda-function-name] + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name] [] { __FUNCTION__; }(); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__FUNCTION__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [misc-lambda-function-name] + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__FUNCTION__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name] [] { FUNC_MACRO; }(); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [misc-lambda-function-name] + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name] [] { FUNCTION_MACRO; }(); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__FUNCTION__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [misc-lambda-function-name] + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__FUNCTION__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name] [] { EMBED_IN_ANOTHER_MACRO1; }(); - // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [misc-lambda-function-name] + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name] } #define FUNC_MACRO_WITH_FILE_AND_LINE Foo(__func__, __FILE__, __LINE__) diff --git a/clang-tools-extra/test/clang-tidy/misc-macro-repeated-side-effects.c b/clang-tools-extra/test/clang-tidy/bugprone-macro-repeated-side-effects.c index 7b01cc6ddb7..bcea47a4c11 100644 --- a/clang-tools-extra/test/clang-tidy/misc-macro-repeated-side-effects.c +++ b/clang-tools-extra/test/clang-tidy/bugprone-macro-repeated-side-effects.c @@ -1,9 +1,9 @@ -// RUN: %check_clang_tidy %s misc-macro-repeated-side-effects %t +// RUN: %check_clang_tidy %s bugprone-macro-repeated-side-effects %t #define badA(x,y) ((x)+((x)+(y))+(y)) void bad(int ret, int a, int b) { ret = badA(a++, b); - // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [misc-macro-repeated-side-effects] + // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [bugprone-macro-repeated-side-effects] ret = badA(++a, b); // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' ret = badA(a--, b); diff --git a/clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp b/clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp index dc66335d883..be12614a103 100644 --- a/clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-explicit-only.cpp +++ b/clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: misc-misplaced-widening-cast.CheckImplicitCasts, value: 0}]}" -- +// RUN: %check_clang_tidy %s bugprone-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: bugprone-misplaced-widening-cast.CheckImplicitCasts, value: 0}]}" -- void func(long arg) {} @@ -7,7 +7,7 @@ void assign(int a, int b) { l = a * b; l = (long)(a * b); - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [misc-misplaced-widening-cast] + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast] l = (long)a * b; l = a << 8; diff --git a/clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp b/clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-implicit-enabled.cpp index 9e7cd8134d4..5487b33958b 100644 --- a/clang-tools-extra/test/clang-tidy/misc-misplaced-widening-cast-implicit-enabled.cpp +++ b/clang-tools-extra/test/clang-tidy/bugprone-misplaced-widening-cast-implicit-enabled.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: misc-misplaced-widening-cast.CheckImplicitCasts, value: 1}]}" -- +// RUN: %check_clang_tidy %s bugprone-misplaced-widening-cast %t -- -config="{CheckOptions: [{key: bugprone-misplaced-widening-cast.CheckImplicitCasts, value: 1}]}" -- void func(long arg) {} @@ -6,7 +6,7 @@ void assign(int a, int b) { long l; l = a * b; - // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [misc-misplaced-widening-cast] + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast] l = (long)(a * b); // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: either cast from 'int' to 'long' l = (long)a * b; |