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
This commit is contained in:
Alexander Kornienko 2018-02-28 14:47:20 +00:00
parent 7e4eee9831
commit a1a2933634
24 changed files with 92 additions and 80 deletions

View File

@ -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>(

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>(

View File

@ -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>`_

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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__)

View File

@ -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);

View File

@ -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;

View File

@ -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;