clang-tools 23.0.0git
clang::tidy::performance::TypePromotionInMathFnCheck Class Reference

Finds calls to C math library functions with implicit float to double promotions. More...

#include <TypePromotionInMathFnCheck.h>

Inheritance diagram for clang::tidy::performance::TypePromotionInMathFnCheck:
[legend]

Public Member Functions

 TypePromotionInMathFnCheck (StringRef Name, ClangTidyContext *Context)
void registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Finds calls to C math library functions with implicit float to double promotions.

For example, warns on ::sin(0.f), because this function's parameter is a double. You probably meant to call std::sin(0.f) (in C++), or sinf(0.f) (in C).

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/performance/type-promotion-in-math-fn.html

Definition at line 26 of file TypePromotionInMathFnCheck.h.

Constructor & Destructor Documentation

◆ TypePromotionInMathFnCheck()

clang::tidy::performance::TypePromotionInMathFnCheck::TypePromotionInMathFnCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 28 of file TypePromotionInMathFnCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::performance::TypePromotionInMathFnCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 153 of file TypePromotionInMathFnCheck.cpp.

◆ registerMatchers()

void clang::tidy::performance::TypePromotionInMathFnCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 45 of file TypePromotionInMathFnCheck.cpp.

◆ registerPPCallbacks()

void clang::tidy::performance::TypePromotionInMathFnCheck::registerPPCallbacks ( const SourceManager & SM,
Preprocessor * PP,
Preprocessor * ModuleExpanderPP )
override

Definition at line 35 of file TypePromotionInMathFnCheck.cpp.

◆ storeOptions()

void clang::tidy::performance::TypePromotionInMathFnCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

Definition at line 40 of file TypePromotionInMathFnCheck.cpp.


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