clang API Documentation
Class to encapsulate the logic for formatting a diagnostic message. Actual "printing" logic is implemented by subclasses. More...
#include <DiagnosticRenderer.h>


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 44 of file DiagnosticRenderer.h.
| DiagnosticRenderer::DiagnosticRenderer | ( | const LangOptions & | LangOpts, |
| const DiagnosticOptions & | DiagOpts | ||
| ) | [protected] |
Definition at line 126 of file DiagnosticRenderer.cpp.
| DiagnosticRenderer::~DiagnosticRenderer | ( | ) | [protected, virtual] |
Definition at line 130 of file DiagnosticRenderer.cpp.
| virtual void clang::DiagnosticRenderer::beginDiagnostic | ( | DiagOrStoredDiag | D, |
| DiagnosticsEngine::Level | Level | ||
| ) | [inline, protected, virtual] |
Definition at line 96 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
| virtual void clang::DiagnosticRenderer::emitBasicNote | ( | StringRef | Message | ) | [protected, pure virtual] |
Implemented in clang::DiagnosticNoteRenderer, and clang::TextDiagnostic.
| virtual void clang::DiagnosticRenderer::emitCodeContext | ( | SourceLocation | Loc, |
| DiagnosticsEngine::Level | Level, | ||
| SmallVectorImpl< CharSourceRange > & | Ranges, | ||
| ArrayRef< FixItHint > | Hints, | ||
| const SourceManager & | SM | ||
| ) | [protected, pure virtual] |
Implemented in clang::TextDiagnostic.
| void DiagnosticRenderer::emitDiagnostic | ( | SourceLocation | Loc, |
| DiagnosticsEngine::Level | Level, | ||
| StringRef | Message, | ||
| ArrayRef< CharSourceRange > | Ranges, | ||
| ArrayRef< FixItHint > | FixItHints, | ||
| const SourceManager * | SM, | ||
| DiagOrStoredDiag | D = (Diagnostic *)0 |
||
| ) |
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. |
| SM | The SourceManager; will be null if the diagnostic came from the frontend, thus |
| Loc | will be invalid. |
Definition at line 181 of file DiagnosticRenderer.cpp.
References beginDiagnostic(), emitDiagnosticMessage(), endDiagnostic(), getDiagnosticPresumedLoc(), clang::PresumedLoc::getIncludeLoc(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), LangOpts, LastLevel, LastLoc, and mergeFixits().
Referenced by emitStoredDiagnostic().
| virtual void clang::DiagnosticRenderer::emitDiagnosticLoc | ( | SourceLocation | Loc, |
| PresumedLoc | PLoc, | ||
| DiagnosticsEngine::Level | Level, | ||
| ArrayRef< CharSourceRange > | Ranges, | ||
| const SourceManager & | SM | ||
| ) | [protected, pure virtual] |
Implemented in clang::TextDiagnostic.
| virtual void clang::DiagnosticRenderer::emitDiagnosticMessage | ( | SourceLocation | Loc, |
| PresumedLoc | PLoc, | ||
| DiagnosticsEngine::Level | Level, | ||
| StringRef | Message, | ||
| ArrayRef< CharSourceRange > | Ranges, | ||
| const SourceManager * | SM, | ||
| DiagOrStoredDiag | Info | ||
| ) | [protected, pure virtual] |
Implemented in clang::TextDiagnostic.
Referenced by emitDiagnostic().
| virtual void clang::DiagnosticRenderer::emitIncludeLocation | ( | SourceLocation | Loc, |
| PresumedLoc | PLoc, | ||
| const SourceManager & | SM | ||
| ) | [protected, pure virtual] |
Implemented in clang::DiagnosticNoteRenderer, and clang::TextDiagnostic.
| void DiagnosticRenderer::emitStoredDiagnostic | ( | StoredDiagnostic & | Diag | ) |
Definition at line 234 of file DiagnosticRenderer.cpp.
References Diag(), emitDiagnostic(), clang::StoredDiagnostic::getFixIts(), clang::StoredDiagnostic::getLevel(), clang::StoredDiagnostic::getLocation(), clang::FullSourceLoc::getManager(), clang::StoredDiagnostic::getMessage(), clang::StoredDiagnostic::getRanges(), and clang::SourceLocation::isValid().
| virtual void clang::DiagnosticRenderer::endDiagnostic | ( | DiagOrStoredDiag | D, |
| DiagnosticsEngine::Level | Level | ||
| ) | [inline, protected, virtual] |
Definition at line 98 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
const DiagnosticOptions& clang::DiagnosticRenderer::DiagOpts [protected] |
Definition at line 47 of file DiagnosticRenderer.h.
Referenced by clang::TextDiagnostic::emitDiagnosticLoc(), clang::TextDiagnostic::emitDiagnosticMessage(), and clang::TextDiagnostic::emitIncludeLocation().
const LangOptions& clang::DiagnosticRenderer::LangOpts [protected] |
Definition at line 46 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic(), and clang::TextDiagnostic::emitDiagnosticLoc().
The location of the last include whose stack was printed if known.
Same restriction as
Definition at line 60 of file DiagnosticRenderer.h.
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 66 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().
SourceLocation clang::DiagnosticRenderer::LastLoc [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 54 of file DiagnosticRenderer.h.
Referenced by emitDiagnostic().