Index: clang-tidy/bugprone/BugproneTidyModule.cpp =================================================================== --- clang-tidy/bugprone/BugproneTidyModule.cpp +++ 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 @@ "bugprone-fold-init-type"); CheckFactories.registerCheck( "bugprone-forward-declaration-namespace"); + CheckFactories.registerCheck( + "bugprone-forwarding-reference-overload"); CheckFactories.registerCheck( "bugprone-inaccurate-erase"); CheckFactories.registerCheck( "bugprone-incorrect-roundings"); CheckFactories.registerCheck( "bugprone-integer-division"); + CheckFactories.registerCheck( + "bugprone-lambda-function-name"); + CheckFactories.registerCheck( + "bugprone-macro-repeated-side-effects"); CheckFactories.registerCheck( "bugprone-misplaced-operator-in-strlen-in-alloc"); + CheckFactories.registerCheck( + "bugprone-misplaced-widening-cast"); CheckFactories.registerCheck( "bugprone-move-forwarding-reference"); CheckFactories.registerCheck( Index: clang-tidy/bugprone/CMakeLists.txt =================================================================== --- clang-tidy/bugprone/CMakeLists.txt +++ clang-tidy/bugprone/CMakeLists.txt @@ -9,10 +9,14 @@ 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 Index: clang-tidy/bugprone/ForwardingReferenceOverloadCheck.h =================================================================== --- clang-tidy/bugprone/ForwardingReferenceOverloadCheck.h +++ 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 @@ /// 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 @@ 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 Index: clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp =================================================================== --- clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp +++ clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { // Check if the given type is related to std::enable_if. @@ -143,6 +143,6 @@ } } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Index: clang-tidy/bugprone/LambdaFunctionNameCheck.h =================================================================== --- clang-tidy/bugprone/LambdaFunctionNameCheck.h +++ 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 @@ 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 Index: clang-tidy/bugprone/LambdaFunctionNameCheck.cpp =================================================================== --- clang-tidy/bugprone/LambdaFunctionNameCheck.cpp +++ clang-tidy/bugprone/LambdaFunctionNameCheck.cpp @@ -18,7 +18,7 @@ namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { @@ -94,6 +94,6 @@ << PredefinedExpr::getIdentTypeName(E->getIdentType()); } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Index: clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h =================================================================== --- clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.h +++ 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 @@ 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 Index: clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp =================================================================== --- clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp +++ 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 @@ *this, Compiler.getPreprocessor())); } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Index: clang-tidy/bugprone/MisplacedWideningCastCheck.h =================================================================== --- clang-tidy/bugprone/MisplacedWideningCastCheck.h +++ 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 @@ // 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 @@ const bool CheckImplicitCasts; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Index: clang-tidy/bugprone/MisplacedWideningCastCheck.cpp =================================================================== --- clang-tidy/bugprone/MisplacedWideningCastCheck.cpp +++ clang-tidy/bugprone/MisplacedWideningCastCheck.cpp @@ -16,7 +16,7 @@ namespace clang { namespace tidy { -namespace misc { +namespace bugprone { MisplacedWideningCastCheck::MisplacedWideningCastCheck( StringRef Name, ClangTidyContext *Context) @@ -228,6 +228,6 @@ << CalcType << CastType; } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Index: clang-tidy/misc/CMakeLists.txt =================================================================== --- clang-tidy/misc/CMakeLists.txt +++ 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 Index: clang-tidy/misc/MiscTidyModule.cpp =================================================================== --- clang-tidy/misc/MiscTidyModule.cpp +++ 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 @@ class MiscModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { - CheckFactories.registerCheck( - "misc-forwarding-reference-overload"); - CheckFactories.registerCheck( - "misc-lambda-function-name"); CheckFactories.registerCheck("misc-misplaced-const"); CheckFactories.registerCheck( "misc-unconventional-assign-operator"); @@ -57,10 +49,6 @@ "misc-definitions-in-headers"); CheckFactories.registerCheck( "misc-macro-parentheses"); - CheckFactories.registerCheck( - "misc-macro-repeated-side-effects"); - CheckFactories.registerCheck( - "misc-misplaced-widening-cast"); CheckFactories.registerCheck( "misc-new-delete-overloads"); CheckFactories.registerCheck( Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -57,6 +57,18 @@ Improvements to clang-tidy -------------------------- +- The 'misc-misplaced-widening-cast' check was renamed to `bugprone-misplaced-widening-cast + `_ + +- The 'misc-lambda-function-name' check was renamed to `bugprone-lambda-function-name + `_ + +- The 'misc-macro-repeated-side-effects' check was renamed to `bugprone-macro-repeated-side-effects + `_ + +- The 'misc-forwarding-reference-overload' check was renamed to `bugprone-forwarding-reference-overload + `_ + - The 'misc-incorrect-roundings' check was renamed to `bugprone-incorrect-roundings `_ Index: docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst =================================================================== --- docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst +++ 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 Index: docs/clang-tidy/checks/bugprone-lambda-function-name.rst =================================================================== --- docs/clang-tidy/checks/bugprone-lambda-function-name.rst +++ 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 Index: docs/clang-tidy/checks/bugprone-macro-repeated-side-effects.rst =================================================================== --- /dev/null +++ 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. Index: docs/clang-tidy/checks/bugprone-misplaced-widening-cast.rst =================================================================== --- docs/clang-tidy/checks/bugprone-misplaced-widening-cast.rst +++ 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 Index: docs/clang-tidy/checks/list.rst =================================================================== --- docs/clang-tidy/checks/list.rst +++ docs/clang-tidy/checks/list.rst @@ -24,10 +24,14 @@ 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 @@ 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 Index: docs/clang-tidy/checks/misc-macro-repeated-side-effects.rst =================================================================== --- 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. Index: test/clang-tidy/bugprone-forwarding-reference-overload.cpp =================================================================== --- test/clang-tidy/bugprone-forwarding-reference-overload.cpp +++ 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 struct enable_if { typedef T type; }; @@ -20,7 +20,7 @@ class Test1 { public: template 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 Test1(T &&n, int i = 5, ...); // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: constructor accepting a forwarding reference can hide the copy and move constructors Index: test/clang-tidy/bugprone-lambda-function-name.cpp =================================================================== --- test/clang-tidy/bugprone-lambda-function-name.cpp +++ 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 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__) Index: test/clang-tidy/bugprone-macro-repeated-side-effects.c =================================================================== --- test/clang-tidy/bugprone-macro-repeated-side-effects.c +++ 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); Index: test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp =================================================================== --- test/clang-tidy/bugprone-misplaced-widening-cast-explicit-only.cpp +++ 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 @@ 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; Index: test/clang-tidy/bugprone-misplaced-widening-cast-implicit-enabled.cpp =================================================================== --- test/clang-tidy/bugprone-misplaced-widening-cast-implicit-enabled.cpp +++ 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 @@ 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;