clang-tools 22.0.0git
|
Find casts of calculation results to bigger type. More...
#include <MisplacedWideningCastCheck.h>
Public Member Functions | |
MisplacedWideningCastCheck (StringRef Name, ClangTidyContext *Context) | |
void | storeOptions (ClangTidyOptions::OptionMap &Opts) override |
void | registerMatchers (ast_matchers::MatchFinder *Finder) override |
void | check (const ast_matchers::MatchFinder::MatchResult &Result) override |
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 the cast is misplaced, and there can be loss of precision. Otherwise such cast is ineffective.
There is one option:
Definition at line 28 of file MisplacedWideningCastCheck.h.
clang::tidy::bugprone::MisplacedWideningCastCheck::MisplacedWideningCastCheck | ( | StringRef | Name, |
ClangTidyContext * | Context ) |
Definition at line 17 of file MisplacedWideningCastCheck.cpp.
|
override |
Definition at line 178 of file MisplacedWideningCastCheck.cpp.
References clang::tidy::bugprone::getMaxCalculationWidth(), and clang::tidy::bugprone::isFirstWider().
|
override |
Definition at line 27 of file MisplacedWideningCastCheck.cpp.
|
override |
Definition at line 22 of file MisplacedWideningCastCheck.cpp.