clang-tools 23.0.0git
clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck Class Reference

Implements C++ Core Guidelines Type.6. More...

#include <ProTypeMemberInitCheck.h>

Inheritance diagram for clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck:
[legend]

Public Member Functions

 ProTypeMemberInitCheck (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
void storeOptions (ClangTidyOptions::OptionMap &Opts) override

Detailed Description

Implements C++ Core Guidelines Type.6.

Checks that every user-provided constructor value-initializes all class members and base classes that would have undefined behavior otherwise. Also check that any record types without user-provided default constructors are value-initialized where used.

Members initialized through function calls in the body of the constructor will result in false positives.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.html TODO: See if 'fixes' for false positives are optimized away by the compiler. TODO: For classes with multiple constructors, make sure that we don't offer multiple in-class initializer fixits for the same member.

Definition at line 32 of file ProTypeMemberInitCheck.h.

Constructor & Destructor Documentation

◆ ProTypeMemberInitCheck()

clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::ProTypeMemberInitCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 286 of file ProTypeMemberInitCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 337 of file ProTypeMemberInitCheck.cpp.

◆ isLanguageVersionSupported()

bool clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 35 of file ProTypeMemberInitCheck.h.

◆ registerMatchers()

void clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 292 of file ProTypeMemberInitCheck.cpp.

◆ storeOptions()

void clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

Definition at line 359 of file ProTypeMemberInitCheck.cpp.


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