9#ifndef LLVM_CLANG_BASIC_DIAGNOSTICERROR_H
10#define LLVM_CLANG_BASIC_DIAGNOSTICERROR_H
13#include "llvm/Support/Error.h"
25 void log(raw_ostream &OS)
const override { OS <<
"clang diagnostic"; }
33 return llvm::make_error<DiagnosticError>(
40 static std::optional<PartialDiagnosticAt>
take(llvm::Error &Err) {
41 std::optional<PartialDiagnosticAt>
Result;
43 Result = std::move(
E.getDiagnostic());
52 std::error_code convertToErrorCode()
const override {
53 return llvm::inconvertibleErrorCode();
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Carries a Clang diagnostic in an llvm::Error.
DiagnosticError(PartialDiagnosticAt Diag)
static std::optional< PartialDiagnosticAt > take(llvm::Error &Err)
Extracts and returns the diagnostic payload from the given Error if the error is a DiagnosticError.
static llvm::Error create(SourceLocation Loc, PartialDiagnostic Diag)
Creates a new DiagnosticError that contains the given diagnostic at the given location.
PartialDiagnosticAt & getDiagnostic()
const PartialDiagnosticAt & getDiagnostic() const
void log(raw_ostream &OS) const override
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.