clang-tools 22.0.0git
clang::tidy::bugprone::MisplacedWideningCastCheck Class Reference

Find casts of calculation results to bigger type. More...

#include <MisplacedWideningCastCheck.h>

Inheritance diagram for clang::tidy::bugprone::MisplacedWideningCastCheck:
[legend]

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ MisplacedWideningCastCheck()

clang::tidy::bugprone::MisplacedWideningCastCheck::MisplacedWideningCastCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 17 of file MisplacedWideningCastCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::bugprone::MisplacedWideningCastCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

◆ registerMatchers()

void clang::tidy::bugprone::MisplacedWideningCastCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 27 of file MisplacedWideningCastCheck.cpp.

◆ storeOptions()

void clang::tidy::bugprone::MisplacedWideningCastCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

Definition at line 22 of file MisplacedWideningCastCheck.cpp.


The documentation for this class was generated from the following files: