clang-tools 23.0.0git
clang::tidy::bugprone::FoldInitTypeCheck Class Reference

Find and flag invalid initializer values in folds, e.g. More...

#include <FoldInitTypeCheck.h>

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

Public Member Functions

 FoldInitTypeCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Find and flag invalid initializer values in folds, e.g.

std::accumulate. Example:

auto v = {65536L * 65536 * 65536};
std::accumulate(begin(v), end(v), 0 /* int type is too small */);

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/fold-init-type.html

Definition at line 25 of file FoldInitTypeCheck.h.

Constructor & Destructor Documentation

◆ FoldInitTypeCheck()

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

Definition at line 27 of file FoldInitTypeCheck.h.

Member Function Documentation

◆ check()

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

Definition at line 130 of file FoldInitTypeCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::bugprone::FoldInitTypeCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 29 of file FoldInitTypeCheck.h.

◆ registerMatchers()

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

Definition at line 17 of file FoldInitTypeCheck.cpp.


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