clang-tools 10.0.0

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 | State : std::int8_t { State::Throwing = 0, State::NotThrowing = 1, State::Unknown = 2 }

## 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 24 of file ExceptionAnalyzer.h.

## Member Enumeration Documentation

## ◆ State

enum clang::tidy::utils::ExceptionAnalyzer::State : std::int8_t
| strong

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 26 of file ExceptionAnalyzer.h.

## Constructor & Destructor Documentation

## ◆ ExceptionAnalyzer()

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

Referenced by clang::tidy::utils::ExceptionAnalyzer::ExceptionInfo::containsUnknownElements().

## Member Function Documentation

## ◆ analyze() [1/2]

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

Definition at line 250 of file ExceptionAnalyzer.cpp.

Referenced by ignoreExceptions().

## ◆ analyze() [2/2]

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

Definition at line 255 of file ExceptionAnalyzer.cpp.

## ◆ ignoreBadAlloc()

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

Definition at line 126 of file ExceptionAnalyzer.h.

## ◆ ignoreExceptions()

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

Definition at line 127 of file ExceptionAnalyzer.h.

References analyze().

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

- ExceptionAnalyzer.h
- ExceptionAnalyzer.cpp