clang 20.0.0git
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
clang::DiagnosticError Class Reference

Carries a Clang diagnostic in an llvm::Error. More...

#include "clang/Basic/DiagnosticError.h"

Inheritance diagram for clang::DiagnosticError:
Inheritance graph
[legend]

Public Member Functions

 DiagnosticError (PartialDiagnosticAt Diag)
 
void log (raw_ostream &OS) const override
 
PartialDiagnosticAtgetDiagnostic ()
 
const PartialDiagnosticAtgetDiagnostic () const
 

Static Public Member Functions

static llvm::Error create (SourceLocation Loc, PartialDiagnostic Diag)
 Creates a new DiagnosticError that contains the given diagnostic at the given location.
 
static std::optional< PartialDiagnosticAttake (llvm::Error &Err)
 Extracts and returns the diagnostic payload from the given Error if the error is a DiagnosticError.
 

Static Public Attributes

static char ID
 

Detailed Description

Carries a Clang diagnostic in an llvm::Error.

Users should emit the stored diagnostic using the DiagnosticsEngine.

Definition at line 21 of file DiagnosticError.h.

Constructor & Destructor Documentation

◆ DiagnosticError()

clang::DiagnosticError::DiagnosticError ( PartialDiagnosticAt  Diag)
inline

Definition at line 23 of file DiagnosticError.h.

Member Function Documentation

◆ create()

static llvm::Error clang::DiagnosticError::create ( SourceLocation  Loc,
PartialDiagnostic  Diag 
)
inlinestatic

Creates a new DiagnosticError that contains the given diagnostic at the given location.

Definition at line 32 of file DiagnosticError.h.

References Loc.

Referenced by clang::tooling::RefactoringRuleContext::createDiagnosticError().

◆ getDiagnostic() [1/2]

PartialDiagnosticAt & clang::DiagnosticError::getDiagnostic ( )
inline

Definition at line 27 of file DiagnosticError.h.

◆ getDiagnostic() [2/2]

const PartialDiagnosticAt & clang::DiagnosticError::getDiagnostic ( ) const
inline

Definition at line 28 of file DiagnosticError.h.

◆ log()

void clang::DiagnosticError::log ( raw_ostream &  OS) const
inlineoverride

Definition at line 25 of file DiagnosticError.h.

◆ take()

static std::optional< PartialDiagnosticAt > clang::DiagnosticError::take ( llvm::Error &  Err)
inlinestatic

Extracts and returns the diagnostic payload from the given Error if the error is a DiagnosticError.

Returns std::nullopt if the given error is not a DiagnosticError.

Definition at line 40 of file DiagnosticError.h.

References E, and clang::Result.

Member Data Documentation

◆ ID

char DiagnosticError::ID
static

Definition at line 48 of file DiagnosticError.h.


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