clang 20.0.0git
Public Member Functions | List of all members
clang::DiagnosticErrorTrap Class Reference

RAII class that determines when any errors have occurred between the time the instance was created and the time it was queried. More...

#include "clang/Basic/Diagnostic.h"

Public Member Functions

 DiagnosticErrorTrap (DiagnosticsEngine &Diag)
 
bool hasErrorOccurred () const
 Determine whether any errors have occurred since this object instance was created.
 
bool hasUnrecoverableErrorOccurred () const
 Determine whether any unrecoverable errors have occurred since this object instance was created.
 
void reset ()
 Set to initial state of "no errors occurred".
 

Detailed Description

RAII class that determines when any errors have occurred between the time the instance was created and the time it was queried.

Note that you almost certainly do not want to use this. It's usually meaningless to ask whether a particular scope triggered an error message, because error messages outside that scope can mark things invalid (or cause us to reach an error limit), which can suppress errors within that scope.

Definition at line 1064 of file Diagnostic.h.

Constructor & Destructor Documentation

◆ DiagnosticErrorTrap()

clang::DiagnosticErrorTrap::DiagnosticErrorTrap ( DiagnosticsEngine Diag)
inlineexplicit

Definition at line 1070 of file Diagnostic.h.

References reset().

Member Function Documentation

◆ hasErrorOccurred()

bool clang::DiagnosticErrorTrap::hasErrorOccurred ( ) const
inline

Determine whether any errors have occurred since this object instance was created.

Definition at line 1075 of file Diagnostic.h.

Referenced by clang::driver::Driver::generateCompilationDiagnostics().

◆ hasUnrecoverableErrorOccurred()

bool clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred ( ) const
inline

Determine whether any unrecoverable errors have occurred since this object instance was created.

Definition at line 1081 of file Diagnostic.h.

Referenced by clang::Scope::hasUnrecoverableErrorOccurred(), and clang::sema::FunctionScopeInfo::hasUnrecoverableErrorOccurred().

◆ reset()

void clang::DiagnosticErrorTrap::reset ( )
inline

Set to initial state of "no errors occurred".

Definition at line 1086 of file Diagnostic.h.

Referenced by clang::sema::FunctionScopeInfo::Clear(), DiagnosticErrorTrap(), and clang::Scope::Init().


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