class DiagnosticError

Declaration

class DiagnosticError : public ErrorInfo { /* full declaration omitted */ };

Description

Carries a Clang diagnostic in an llvm::Error. Users should emit the stored diagnostic using the DiagnosticsEngine.

Declared at: clang/include/clang/Basic/DiagnosticError.h:20

Inherits from: ErrorInfo

Member Variables

private clang::PartialDiagnosticAt Diag
public static char ID

Method Overview

  • public DiagnosticError(clang::PartialDiagnosticAt Diag)
  • private std::error_code convertToErrorCode() const
  • public static llvm::Error create(clang::SourceLocation Loc, clang::PartialDiagnostic Diag)
  • public clang::PartialDiagnosticAt & getDiagnostic()
  • public const clang::PartialDiagnosticAt & getDiagnostic() const
  • public void log(llvm::raw_ostream & OS) const
  • public static Optional<clang::PartialDiagnosticAt> take(llvm::Error & Err)

Methods

DiagnosticError(clang::PartialDiagnosticAt Diag)

Declared at: clang/include/clang/Basic/DiagnosticError.h:22

Parameters

clang::PartialDiagnosticAt Diag

std::error_code convertToErrorCode() const

Description

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.

Declared at: clang/include/clang/Basic/DiagnosticError.h:51

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

Description

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

Declared at: clang/include/clang/Basic/DiagnosticError.h:31

Parameters

clang::SourceLocation Loc
clang::PartialDiagnostic Diag

clang::PartialDiagnosticAt& getDiagnostic()

Declared at: clang/include/clang/Basic/DiagnosticError.h:26

const clang::PartialDiagnosticAt& getDiagnostic()
    const

Declared at: clang/include/clang/Basic/DiagnosticError.h:27

void log(llvm::raw_ostream& OS) const

Description

Print an error message to an output stream.

Declared at: clang/include/clang/Basic/DiagnosticError.h:24

Parameters

llvm::raw_ostream& OS

static Optional<clang::PartialDiagnosticAt> take(
    llvm::Error& Err)

Description

Extracts and returns the diagnostic payload from the given \c Error if the error is a \c DiagnosticError. Returns none if the given error is not a \c DiagnosticError.

Declared at: clang/include/clang/Basic/DiagnosticError.h:39

Parameters

llvm::Error& Err