clang-tools 22.0.0git
clang::tidy::misc::StaticAssertCheck Class Reference

Replaces assert() with static_assert() if the condition is evaluatable at compile time. More...

#include <StaticAssertCheck.h>

Inheritance diagram for clang::tidy::misc::StaticAssertCheck:
[legend]

Public Member Functions

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

Replaces assert() with static_assert() if the condition is evaluatable at compile time.

The condition of static_assert() is evaluated at compile time which is safer and more efficient.

Definition at line 23 of file StaticAssertCheck.h.

Constructor & Destructor Documentation

◆ StaticAssertCheck()

clang::tidy::misc::StaticAssertCheck::StaticAssertCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 24 of file StaticAssertCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::misc::StaticAssertCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 76 of file StaticAssertCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::misc::StaticAssertCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 26 of file StaticAssertCheck.h.

◆ registerMatchers()

void clang::tidy::misc::StaticAssertCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 27 of file StaticAssertCheck.cpp.


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