clang-tools 19.0.0git
Classes | Public Types | Public Member Functions | List of all members
clang::tidy::utils::ExceptionAnalyzer Class Reference

This class analysis if a FunctionDecl can in principle throw an exception, either directly or indirectly. More...

#include <ExceptionAnalyzer.h>

Classes

class  ExceptionInfo
 Bundle the gathered information about an entity like a function regarding it's exception behaviour. More...
 

Public Types

enum class  State { Throwing , NotThrowing , Unknown }
 

Public Member Functions

 ExceptionAnalyzer ()=default
 
void ignoreBadAlloc (bool ShallIgnore)
 
void ignoreExceptions (llvm::StringSet<> ExceptionNames)
 
ExceptionInfo analyze (const FunctionDecl *Func)
 
ExceptionInfo analyze (const Stmt *Stmt)
 

Detailed Description

This class analysis if a FunctionDecl can in principle throw an exception, either directly or indirectly.

It can be configured to ignore custom exception types.

Definition at line 22 of file ExceptionAnalyzer.h.

Member Enumeration Documentation

◆ State

Enumerator
Throwing 

The function can definitely throw given an AST.

NotThrowing 

This function can not throw, given an AST.

Unknown 

This can happen for extern functions without available definition.

Definition at line 24 of file ExceptionAnalyzer.h.

Constructor & Destructor Documentation

◆ ExceptionAnalyzer()

clang::tidy::utils::ExceptionAnalyzer::ExceptionAnalyzer ( )
default

Member Function Documentation

◆ analyze() [1/2]

ExceptionAnalyzer::ExceptionInfo clang::tidy::utils::ExceptionAnalyzer::analyze ( const FunctionDecl *  Func)

Definition at line 624 of file ExceptionAnalyzer.cpp.

◆ analyze() [2/2]

ExceptionAnalyzer::ExceptionInfo clang::tidy::utils::ExceptionAnalyzer::analyze ( const Stmt *  Stmt)

Definition at line 628 of file ExceptionAnalyzer.cpp.

◆ ignoreBadAlloc()

void clang::tidy::utils::ExceptionAnalyzer::ignoreBadAlloc ( bool  ShallIgnore)
inline

◆ ignoreExceptions()

void clang::tidy::utils::ExceptionAnalyzer::ignoreExceptions ( llvm::StringSet<>  ExceptionNames)
inline

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