class Sema::SemaDiagnosticBuilder

Declaration

class Sema::SemaDiagnosticBuilder { /* full declaration omitted */ };

Description

A generic diagnostic builder for errors which may or may not be deferred. In CUDA, there exist constructs (e.g. variable-length arrays, try/catch) which are not allowed to appear inside __device__ functions and are allowed to appear in __host__ __device__ functions only if the host+device function is never codegen'ed. To handle this, we use the notion of "deferred diagnostics", where we attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed. This class lets you emit either a regular diagnostic, a deferred diagnostic, or no diagnostic at all, according to an argument you pass to its constructor, thus simplifying the process of creating these "maybe deferred" diagnostics.

Declared at: clang/include/clang/Sema/Sema.h:1733

Member Variables

private clang::Sema& S
private clang::SourceLocation Loc
private unsigned int DiagID
private clang::FunctionDecl* Fn
private bool ShowCallStack
private llvm::Optional<ImmediateDiagBuilder> ImmediateDiag
private llvm::Optional<unsigned int> PartialDiagId

Method Overview

Methods

void AddFixItHint(
    const clang::FixItHint& Hint) const

Declared at: clang/include/clang/Sema/Sema.h:1803

Parameters

const clang::FixItHint& Hint

SemaDiagnosticBuilder(
    clang::Sema::SemaDiagnosticBuilder::Kind K,
    clang::SourceLocation Loc,
    unsigned int DiagID,
    clang::FunctionDecl* Fn,
    clang::Sema& S)

Declared at: clang/include/clang/Sema/Sema.h:1750

Parameters

clang::Sema::SemaDiagnosticBuilder::Kind K
clang::SourceLocation Loc
unsigned int DiagID
clang::FunctionDecl* Fn
clang::Sema& S

SemaDiagnosticBuilder(
    clang::Sema::SemaDiagnosticBuilder&& D)

Declared at: clang/include/clang/Sema/Sema.h:1752

Parameters

clang::Sema::SemaDiagnosticBuilder&& D

SemaDiagnosticBuilder(
    const clang::Sema::SemaDiagnosticBuilder&)

Declared at: clang/include/clang/Sema/Sema.h:1753

Parameters

const clang::Sema::SemaDiagnosticBuilder&

bool isImmediate() const

Declared at: clang/include/clang/Sema/Sema.h:1756

clang::ExprResult operator ActionResult() const

Declared at: clang/include/clang/Sema/Sema.h:1816

clang::ExprResult operator ActionResult() const

Declared at: clang/include/clang/Sema/Sema.h:1816

clang::ExprResult operator ActionResult() const

Declared at: clang/include/clang/Sema/Sema.h:1816

clang::ExprResult operator ActionResult() const

Declared at: clang/include/clang/Sema/Sema.h:1816

clang::ExprResult operator ActionResult() const

Declared at: clang/include/clang/Sema/Sema.h:1816

bool operator bool() const

Description

Convertible to bool: True if we immediately emitted an error, false if we didn't emit an error or we created a deferred error. Example usage: if (SemaDiagnosticBuilder(...) < < foo < < bar) return ExprError(); But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably want to use these instead of creating a SemaDiagnosticBuilder yourself.

Declared at: clang/include/clang/Sema/Sema.h:1768

~SemaDiagnosticBuilder()

Declared at: clang/include/clang/Sema/Sema.h:1754