clang 20.0.0git
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::StreamingDiagnostic Class Reference

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

#include "clang/Basic/Diagnostic.h"

Inheritance diagram for clang::StreamingDiagnostic:
Inheritance graph
[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 1102 of file Diagnostic.h.

Member Typedef Documentation

◆ DiagStorageAllocator

Definition at line 1104 of file Diagnostic.h.

Constructor & Destructor Documentation

◆ StreamingDiagnostic() [1/4]

clang::StreamingDiagnostic::StreamingDiagnostic ( )
protecteddefault

◆ 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 1195 of file Diagnostic.h.

◆ StreamingDiagnostic() [3/4]

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

◆ StreamingDiagnostic() [4/4]

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

◆ ~StreamingDiagnostic()

clang::StreamingDiagnostic::~StreamingDiagnostic ( )
inlineprotected

Definition at line 1201 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()

void clang::StreamingDiagnostic::AddString ( StringRef  V) const
inline

◆ AddTaggedVal()

void clang::StreamingDiagnostic::AddTaggedVal ( uint64_t  V,
DiagnosticsEngine::ArgumentKind  Kind 
) const
inline

◆ freeStorage()

void clang::StreamingDiagnostic::freeStorage ( )
inline

◆ freeStorageSlow()

void clang::StreamingDiagnostic::freeStorageSlow ( )
inline

Definition at line 1136 of file Diagnostic.h.

References Allocator, clang::DiagStorageAllocator::Deallocate(), and DiagStorage.

Referenced by freeStorage().

◆ getStorage()

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

◆ 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 1188 of file Diagnostic.h.

Member Data Documentation

◆ Allocator

DiagStorageAllocator* clang::StreamingDiagnostic::Allocator = nullptr
protected

◆ DiagStorage

DiagnosticStorage* clang::StreamingDiagnostic::DiagStorage = nullptr
mutableprotected

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