clang 22.0.0git
|
A little helper class used to produce diagnostics. More...
#include "clang/Basic/Diagnostic.h"
Public Member Functions | |
DiagnosticBuilder (const DiagnosticBuilder &D) | |
Copy constructor. | |
template<typename T > | |
const DiagnosticBuilder & | operator<< (const T &V) const |
template<typename T , typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>> | |
const DiagnosticBuilder & | operator<< (T &&V) const |
DiagnosticBuilder & | operator= (const DiagnosticBuilder &)=delete |
~DiagnosticBuilder () | |
Emits the diagnostic. | |
const DiagnosticBuilder & | setForceEmit () const |
Forces the diagnostic to be emitted. | |
void | addFlagValue (StringRef V) const |
![]() | |
DiagnosticStorage * | getStorage () 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 | |
DiagnosticBuilder (DiagnosticsEngine *DiagObj, SourceLocation DiagLoc, unsigned DiagID) | |
DiagnosticsEngine * | getDiagnosticsEngine () const |
unsigned | getDiagID () const |
void | Clear () const |
Clear out the current diagnostic. | |
bool | isActive () const |
Determine whether this diagnostic is still active. | |
bool | Emit () |
Force the diagnostic builder to emit the diagnostic now. | |
![]() | |
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 () | |
Friends | |
class | DiagnosticsEngine |
class | PartialDiagnostic |
class | Diagnostic |
Additional Inherited Members | |
![]() | |
using | DiagStorageAllocator = clang::DiagStorageAllocator |
![]() | |
DiagnosticStorage * | DiagStorage = nullptr |
DiagStorageAllocator * | Allocator = nullptr |
Allocator used to allocate storage for this diagnostic. | |
A little helper class used to produce diagnostics.
This is constructed by the DiagnosticsEngine::Report method, and allows insertion of extra information (arguments and source ranges) into the currently "in flight" diagnostic. When the temporary for the builder is destroyed, the diagnostic is issued.
Note that many of these will be created as temporary objects (many call sites), so we want them to be small and we never want their address taken. This ensures that compilers with somewhat reasonable optimizers will promote the common fields to registers, eliminating increments of the NumArgs field, for example.
Definition at line 1233 of file Diagnostic.h.
|
protected |
Definition at line 777 of file Diagnostic.cpp.
DiagnosticBuilder::DiagnosticBuilder | ( | const DiagnosticBuilder & | D | ) |
Copy constructor.
When copied, this "takes" the diagnostic info from the input and neuters it.
Definition at line 784 of file Diagnostic.cpp.
References clang::StreamingDiagnostic::Allocator, D, and clang::StreamingDiagnostic::DiagStorage.
|
inline |
|
inline |
|
inlineprotected |
Clear out the current diagnostic.
Definition at line 1271 of file Diagnostic.h.
Referenced by Emit(), clang::PartialDiagnostic::EmitToString(), clang::SemaBase::ImmediateDiagBuilder::~ImmediateDiagBuilder(), and clang::CodeGen::TrapReasonBuilder::~TrapReasonBuilder().
|
inlineprotected |
Force the diagnostic builder to emit the diagnostic now.
Once this function has been called, the DiagnosticBuilder object should not be used again before it is destroyed.
Definition at line 1287 of file Diagnostic.h.
References Clear(), clang::DiagnosticsEngine::EmitDiagnostic(), isActive(), and clang::Result.
Referenced by ~DiagnosticBuilder().
|
inlineprotected |
Definition at line 1268 of file Diagnostic.h.
|
inlineprotected |
Definition at line 1267 of file Diagnostic.h.
|
inlineprotected |
Determine whether this diagnostic is still active.
Definition at line 1278 of file Diagnostic.h.
Referenced by Emit(), operator<<(), and clang::SemaBase::ImmediateDiagBuilder::~ImmediateDiagBuilder().
|
inline |
Definition at line 1307 of file Diagnostic.h.
References isActive(), and V.
|
inline |
Definition at line 1319 of file Diagnostic.h.
References isActive(), and V.
|
delete |
|
inline |
Forces the diagnostic to be emitted.
Definition at line 1332 of file Diagnostic.h.
Referenced by PrintExpected(), and PrintUnexpected().
|
friend |
Definition at line 1236 of file Diagnostic.h.
|
friend |
Definition at line 1234 of file Diagnostic.h.
|
friend |
Definition at line 1235 of file Diagnostic.h.