LLVM 19.0.0git
Public Member Functions | List of all members
llvm::ExitOnError Class Reference

Helper for check-and-exit error handling. More...

#include "llvm/Support/Error.h"

Public Member Functions

 ExitOnError (std::string Banner="", int DefaultErrorExitCode=1)
 Create an error on exit helper.
 
void setBanner (std::string Banner)
 Set the banner string for any errors caught by operator().
 
void setExitCodeMapper (std::function< int(const Error &)> GetExitCode)
 Set the exit-code mapper function.
 
void operator() (Error Err) const
 Check Err. If it's in a failure state log the error(s) and exit.
 
template<typename T >
T operator() (Expected< T > &&E) const
 Check E.
 
template<typename T >
Toperator() (Expected< T & > &&E) const
 Check E.
 

Detailed Description

Helper for check-and-exit error handling.

For tool use only. NOT FOR USE IN LIBRARY CODE.

Definition at line 1367 of file Error.h.

Constructor & Destructor Documentation

◆ ExitOnError()

llvm::ExitOnError::ExitOnError ( std::string  Banner = "",
int  DefaultErrorExitCode = 1 
)
inline

Create an error on exit helper.

Definition at line 1370 of file Error.h.

Member Function Documentation

◆ operator()() [1/3]

void llvm::ExitOnError::operator() ( Error  Err) const
inline

Check Err. If it's in a failure state log the error(s) and exit.

Definition at line 1383 of file Error.h.

◆ operator()() [2/3]

template<typename T >
T & llvm::ExitOnError::operator() ( Expected< T & > &&  E) const
inline

Check E.

If it's in a success state then return the contained reference. If it's in a failure state log the error(s) and exit.

Definition at line 1394 of file Error.h.

References E.

◆ operator()() [3/3]

template<typename T >
T llvm::ExitOnError::operator() ( Expected< T > &&  E) const
inline

Check E.

If it's in a success state then return the contained value. If it's in a failure state log the error(s) and exit.

Definition at line 1387 of file Error.h.

References E.

◆ setBanner()

void llvm::ExitOnError::setBanner ( std::string  Banner)
inline

Set the banner string for any errors caught by operator().

Definition at line 1375 of file Error.h.

◆ setExitCodeMapper()

void llvm::ExitOnError::setExitCodeMapper ( std::function< int(const Error &)>  GetExitCode)
inline

Set the exit-code mapper function.

Definition at line 1378 of file Error.h.


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