class DiagnosticBuilder
Declaration
class DiagnosticBuilder : public StreamingDiagnostic { /* full declaration omitted */ };
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:1266
Inherits from: StreamingDiagnostic
Member Variables
- private clang::DiagnosticsEngine* DiagObj = nullptr
- private bool IsActive = false
- Status variable indicating if this diagnostic is still active.
- private bool IsForceEmit = false
- Flag indicating that this diagnostic is being emitted via a call to ForceEmit.
Inherited from StreamingDiagnostic:
- protected DiagStorage = nullptr
- protected Allocator = nullptr
Method Overview
- protected void Clear() const
- private DiagnosticBuilder()
- private DiagnosticBuilder(clang::DiagnosticsEngine * diagObj)
- public DiagnosticBuilder(const clang::DiagnosticBuilder & D)
- protected bool Emit()
- public void addFlagValue(llvm::StringRef V) const
- protected bool isActive() const
- public const clang::DiagnosticBuilder & setForceEmit() const
- public ~DiagnosticBuilder()
Inherited from StreamingDiagnostic:
- public AddFixItHint
- public AddSourceRange
- public AddString
- public AddTaggedVal
- public freeStorage
- public freeStorageSlow
- public getStorage
- public operator bool
Methods
¶void Clear() const
void Clear() const
Description
Clear out the current diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:1298
¶DiagnosticBuilder()
DiagnosticBuilder()
Declared at: clang/include/clang/Basic/Diagnostic.h:1283
¶DiagnosticBuilder(
clang::DiagnosticsEngine* diagObj)
DiagnosticBuilder(
clang::DiagnosticsEngine* diagObj)
Declared at: clang/include/clang/Basic/Diagnostic.h:1285
Parameters
- clang::DiagnosticsEngine* diagObj
¶DiagnosticBuilder(
const clang::DiagnosticBuilder& D)
DiagnosticBuilder(
const clang::DiagnosticBuilder& D)
Description
Copy constructor. When copied, this "takes" the diagnostic info from the input and neuters it.
Declared at: clang/include/clang/Basic/Diagnostic.h:1331
Parameters
- const clang::DiagnosticBuilder& D
¶bool Emit()
bool Emit()
Description
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.
Declared at: clang/include/clang/Basic/Diagnostic.h:1314
Returns
true if a diagnostic was emitted, false if the diagnostic was suppressed.
¶void addFlagValue(llvm::StringRef V) const
void addFlagValue(llvm::StringRef V) const
Declared at: clang/include/clang/Basic/Diagnostic.h:1369
Parameters
¶bool isActive() const
bool isActive() const
Description
Determine whether this diagnostic is still active.
Declared at: clang/include/clang/Basic/Diagnostic.h:1305
¶const clang::DiagnosticBuilder& setForceEmit()
const
const clang::DiagnosticBuilder& setForceEmit()
const
Description
Forces the diagnostic to be emitted.
Declared at: clang/include/clang/Basic/Diagnostic.h:1364
¶~DiagnosticBuilder()
~DiagnosticBuilder()
Description
Emits the diagnostic.
Declared at: clang/include/clang/Basic/Diagnostic.h:1361