LLVM 19.0.0git
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
llvm::ErrorReported Class Referencefinal

An error that has already been reported. More...

#include "FileCheck/FileCheckImpl.h"

Inheritance diagram for llvm::ErrorReported:
Inheritance graph
[legend]

Public Member Functions

std::error_code convertToErrorCode () const override
 Convert this error to a std::error_code.
 
void log (raw_ostream &OS) const override
 Print diagnostic associated with this error when printing the error.
 
- Public Member Functions inherited from llvm::ErrorInfo< ErrorReported >
const void * dynamicClassID () const override
 
bool isA (const void *const ClassID) const override
 
- Public Member Functions inherited from llvm::ErrorInfoBase
virtual ~ErrorInfoBase ()=default
 
virtual void log (raw_ostream &OS) const =0
 Print an error message to an output stream.
 
virtual std::string message () const
 Return the error message as a string.
 
virtual std::error_code convertToErrorCode () const =0
 Convert this error to a std::error_code.
 
virtual const void * dynamicClassID () const =0
 
virtual bool isA (const void *const ClassID) const
 
template<typename ErrorInfoT >
bool isA () const
 

Static Public Member Functions

static Error reportedOrSuccess (bool HasErrorReported)
 
- Static Public Member Functions inherited from llvm::ErrorInfo< ErrorReported >
static const void * classID ()
 
- Static Public Member Functions inherited from llvm::ErrorInfoBase
static const void * classID ()
 

Static Public Attributes

static char ID = 0
 

Detailed Description

An error that has already been reported.

This class is designed to support a function whose callers may need to know whether the function encountered and reported an error but never need to know the nature of that error. For example, the function has a return type of Error and always returns either ErrorReported or ErrorSuccess. That interface is similar to that of a function returning bool to indicate an error except, in the former case, (1) there is no confusion over polarity and (2) the caller must either check the result or explicitly ignore it with a call like consumeError.

Definition at line 545 of file FileCheckImpl.h.

Member Function Documentation

◆ convertToErrorCode()

std::error_code llvm::ErrorReported::convertToErrorCode ( ) const
inlineoverridevirtual

Convert this error to a std::error_code.

This is a temporary crutch to enable interaction with code still using std::error_code. It will be removed in the future.

Implements llvm::ErrorInfoBase.

Definition at line 549 of file FileCheckImpl.h.

References llvm::inconvertibleErrorCode().

◆ log()

void llvm::ErrorReported::log ( raw_ostream OS) const
inlineoverridevirtual

Print diagnostic associated with this error when printing the error.

Implements llvm::ErrorInfoBase.

Definition at line 554 of file FileCheckImpl.h.

References OS.

◆ reportedOrSuccess()

static Error llvm::ErrorReported::reportedOrSuccess ( bool  HasErrorReported)
inlinestatic

Definition at line 558 of file FileCheckImpl.h.

References llvm::Error::success().

Referenced by printMatch(), and printNoMatch().

Member Data Documentation

◆ ID

char ErrorReported::ID = 0
static

Definition at line 547 of file FileCheckImpl.h.


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