clang 22.0.0git
clang::StreamingDiagnostic Class Reference

The streaming interface shared between DiagnosticBuilder and PartialDiagnostic. More...

#include "clang/Basic/Diagnostic.h"

Inheritance diagram for clang::StreamingDiagnostic:
[legend]

Public Types

using DiagStorageAllocator = clang::DiagStorageAllocator

Public Member Functions

DiagnosticStoragegetStorage () const
 Retrieve storage for this particular diagnostic.
void freeStorage ()
void freeStorageSlow ()
void AddTaggedVal (uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
void AddString (StringRef V) const
void AddSourceRange (const CharSourceRange &R) const
void AddFixItHint (const FixItHint &Hint) const
 operator bool () const
 Conversion of StreamingDiagnostic to bool always returns true.

Protected Member Functions

 StreamingDiagnostic ()=default
 StreamingDiagnostic (DiagStorageAllocator &Alloc)
 Construct with a storage allocator which will manage the storage.
 StreamingDiagnostic (const StreamingDiagnostic &Diag)=default
 StreamingDiagnostic (StreamingDiagnostic &&Diag)=default
 ~StreamingDiagnostic ()

Protected Attributes

DiagnosticStorageDiagStorage = nullptr
DiagStorageAllocatorAllocator = nullptr
 Allocator used to allocate storage for this diagnostic.

Detailed Description

The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.

This class is not intended to be constructed directly but only as base class of DiagnosticBuilder and PartialDiagnostic builder.

Any new type of argument accepted by DiagnosticBuilder and PartialDiagnostic should be implemented as a '<<' operator of StreamingDiagnostic, e.g.

const StreamingDiagnostic& operator<<(const StreamingDiagnostic&, NewArgType);

Definition at line 1115 of file Diagnostic.h.

Member Typedef Documentation

◆ DiagStorageAllocator

Constructor & Destructor Documentation

◆ StreamingDiagnostic() [1/4]

◆ StreamingDiagnostic() [2/4]

clang::StreamingDiagnostic::StreamingDiagnostic ( DiagStorageAllocator & Alloc)
inlineexplicitprotected

Construct with a storage allocator which will manage the storage.

The allocator is not a null pointer in this case.

Definition at line 1208 of file Diagnostic.h.

References Allocator.

◆ StreamingDiagnostic() [3/4]

clang::StreamingDiagnostic::StreamingDiagnostic ( const StreamingDiagnostic & Diag)
protecteddefault

References Diag(), and StreamingDiagnostic().

◆ StreamingDiagnostic() [4/4]

clang::StreamingDiagnostic::StreamingDiagnostic ( StreamingDiagnostic && Diag)
protecteddefault

References Diag(), and StreamingDiagnostic().

◆ ~StreamingDiagnostic()

clang::StreamingDiagnostic::~StreamingDiagnostic ( )
inlineprotected

Definition at line 1214 of file Diagnostic.h.

References freeStorage().

Member Function Documentation

◆ AddFixItHint()

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

◆ AddSourceRange()

void clang::StreamingDiagnostic::AddSourceRange ( const CharSourceRange & R) const
inline

◆ AddString()

◆ AddTaggedVal()

◆ freeStorage()

void clang::StreamingDiagnostic::freeStorage ( )
inline

◆ freeStorageSlow()

void clang::StreamingDiagnostic::freeStorageSlow ( )
inline

Definition at line 1149 of file Diagnostic.h.

References Allocator, and DiagStorage.

Referenced by freeStorage().

◆ getStorage()

DiagnosticStorage * clang::StreamingDiagnostic::getStorage ( ) const
inline

Retrieve storage for this particular diagnostic.

Definition at line 1127 of file Diagnostic.h.

References Allocator, and DiagStorage.

Referenced by AddFixItHint(), AddSourceRange(), AddString(), AddTaggedVal(), and clang::PartialDiagnostic::operator=().

◆ operator bool()

clang::StreamingDiagnostic::operator bool ( ) const
inline

Conversion of StreamingDiagnostic to bool always returns true.

This allows is to be used in boolean error contexts (where true is used to indicate that an error has occurred), like:

return Diag(...);
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.

Definition at line 1201 of file Diagnostic.h.

Member Data Documentation

◆ Allocator

◆ DiagStorage


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