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

Warns when the code is unwrapping a std::optional<T>, absl::optional<T>, or base::std::optional<T> object without assuring that it contains a value. More...

#include <UncheckedOptionalAccessCheck.h>

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

Public Member Functions

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

Detailed Description

Warns when the code is unwrapping a std::optional<T>, absl::optional<T>, or base::std::optional<T> object without assuring that it contains a value.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unchecked-optional-access.html

Definition at line 24 of file UncheckedOptionalAccessCheck.h.

Constructor & Destructor Documentation

◆ UncheckedOptionalAccessCheck()

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

Definition at line 26 of file UncheckedOptionalAccessCheck.h.

Member Function Documentation

◆ check()

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

Definition at line 44 of file UncheckedOptionalAccessCheck.cpp.

References FuncDecl, and clang::tidy::bugprone::FuncID().

◆ isLanguageVersionSupported()

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

Definition at line 31 of file UncheckedOptionalAccessCheck.h.

◆ registerMatchers()

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

Definition at line 27 of file UncheckedOptionalAccessCheck.cpp.

References clang::tidy::bugprone::FuncID().

◆ storeOptions()

void clang::tidy::bugprone::UncheckedOptionalAccessCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
inlineoverride

Definition at line 34 of file UncheckedOptionalAccessCheck.h.


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