clang-tools 22.0.0git
clang::tidy::cppcoreguidelines::AvoidGotoCheck Class Reference

The usage of goto for control flow is error prone and should be replaced with looping constructs. More...

#include <AvoidGotoCheck.h>

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

Public Member Functions

 AvoidGotoCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const 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

The usage of goto for control flow is error prone and should be replaced with looping constructs.

Only forward jumps in nested loops are accepted. For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-goto.html

Definition at line 21 of file AvoidGotoCheck.h.

Constructor & Destructor Documentation

◆ AvoidGotoCheck()

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

Definition at line 26 of file AvoidGotoCheck.cpp.

Member Function Documentation

◆ check()

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

Definition at line 53 of file AvoidGotoCheck.cpp.

◆ isLanguageVersionSupported()

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

Definition at line 24 of file AvoidGotoCheck.h.

◆ registerMatchers()

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

Definition at line 34 of file AvoidGotoCheck.cpp.

◆ storeOptions()

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

Definition at line 30 of file AvoidGotoCheck.cpp.


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