clang 20.0.0git
|
Class to encapsulate the logic for formatting a diagnostic message. More...
#include "clang/Frontend/DiagnosticRenderer.h"
Public Member Functions | |
void | emitDiagnostic (FullSourceLoc Loc, DiagnosticsEngine::Level Level, StringRef Message, ArrayRef< CharSourceRange > Ranges, ArrayRef< FixItHint > FixItHints, DiagOrStoredDiag D=(Diagnostic *) nullptr) |
Emit a diagnostic. | |
void | emitStoredDiagnostic (StoredDiagnostic &Diag) |
Protected Attributes | |
const LangOptions & | LangOpts |
IntrusiveRefCntPtr< DiagnosticOptions > | DiagOpts |
SourceLocation | LastLoc |
The location of the previous diagnostic if known. | |
SourceLocation | LastIncludeLoc |
The location of the last include whose stack was printed if known. | |
DiagnosticsEngine::Level | LastLevel = DiagnosticsEngine::Ignored |
The level of the last diagnostic emitted. | |
Class to encapsulate the logic for formatting a diagnostic message.
Actual "printing" logic is implemented by subclasses.
This class provides an interface for building and emitting diagnostic, including all of the macro backtraces, caret diagnostics, FixIt Hints, and code snippets. In the presence of macros this involves a recursive process, synthesizing notes for each macro expansion.
A brief worklist: FIXME: Sink the recursive printing of template instantiations into this class.
Definition at line 47 of file DiagnosticRenderer.h.
|
protected |
Definition at line 32 of file DiagnosticRenderer.cpp.
|
protectedvirtualdefault |
|
inlineprotectedvirtual |
Definition at line 97 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
|
protectedpure virtual |
Implemented in clang::DiagnosticNoteRenderer, clang::SARIFDiagnostic, and clang::TextDiagnostic.
|
protectedpure virtual |
Implemented in clang::SARIFDiagnostic, and clang::TextDiagnostic.
void DiagnosticRenderer::emitDiagnostic | ( | FullSourceLoc | Loc, |
DiagnosticsEngine::Level | Level, | ||
StringRef | Message, | ||
ArrayRef< CharSourceRange > | Ranges, | ||
ArrayRef< FixItHint > | FixItHints, | ||
DiagOrStoredDiag | D = (Diagnostic *)nullptr |
||
) |
Emit a diagnostic.
This is the primary entry point for emitting diagnostic messages. It handles formatting and rendering the message as well as any ancillary information needed based on macros whose expansions impact the diagnostic.
Loc | The location for this caret. |
Level | The level of the diagnostic to be emitted. |
Message | The diagnostic message to emit. |
Ranges | The underlined ranges for this code snippet. |
FixItHints | The FixIt hints active for this diagnostic. |
Definition at line 86 of file DiagnosticRenderer.cpp.
References beginDiagnostic(), D, DiagOpts, emitDiagnosticMessage(), endDiagnostic(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isMacroID(), clang::SourceLocation::isValid(), LangOpts, LastLevel, LastLoc, Loc, and mergeFixits().
Referenced by emitStoredDiagnostic().
|
protectedpure virtual |
Implemented in clang::SARIFDiagnostic, and clang::TextDiagnostic.
|
protectedpure virtual |
Implemented in clang::SARIFDiagnostic, and clang::TextDiagnostic.
Referenced by emitDiagnostic().
|
protectedpure virtual |
Implemented in clang::DiagnosticNoteRenderer, clang::SARIFDiagnostic, and clang::TextDiagnostic.
|
protectedpure virtual |
Implemented in clang::DiagnosticNoteRenderer, clang::SARIFDiagnostic, and clang::TextDiagnostic.
void DiagnosticRenderer::emitStoredDiagnostic | ( | StoredDiagnostic & | Diag | ) |
Definition at line 141 of file DiagnosticRenderer.cpp.
References Diag(), and emitDiagnostic().
|
inlineprotectedvirtual |
Definition at line 99 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
|
protected |
Definition at line 50 of file DiagnosticRenderer.h.
Referenced by clang::TextDiagnostic::emitBuildingModuleLocation(), emitDiagnostic(), clang::TextDiagnostic::emitDiagnosticLoc(), clang::TextDiagnostic::emitDiagnosticMessage(), clang::TextDiagnostic::emitImportLocation(), and clang::TextDiagnostic::emitIncludeLocation().
|
protected |
Definition at line 49 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic(), and clang::TextDiagnostic::emitDiagnosticLoc().
|
protected |
The location of the last include whose stack was printed if known.
Same restriction as LastLoc essentially, but tracking include stack root locations rather than diagnostic locations.
Definition at line 63 of file DiagnosticRenderer.h.
|
protected |
The level of the last diagnostic emitted.
The level of the last diagnostic emitted. Used to detect level changes which change the amount of information displayed.
Definition at line 69 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
|
protected |
The location of the previous diagnostic if known.
This will be invalid in cases where there is no (known) previous diagnostic location, or that location itself is invalid or comes from a different source manager than SM.
Definition at line 57 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().