clang 20.0.0git
|
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine and DiagnosticStorage) that allows clients to enquire about the diagnostic. More...
#include "clang/Basic/Diagnostic.h"
Public Member Functions | |
Diagnostic (const DiagnosticsEngine *DO, const DiagnosticBuilder &DiagBuilder) | |
Diagnostic (const DiagnosticsEngine *DO, SourceLocation DiagLoc, unsigned DiagID, const DiagnosticStorage &DiagStorage, StringRef StoredDiagMessage) | |
const DiagnosticsEngine * | getDiags () const |
unsigned | getID () const |
const SourceLocation & | getLocation () const |
bool | hasSourceManager () const |
SourceManager & | getSourceManager () const |
unsigned | getNumArgs () const |
DiagnosticsEngine::ArgumentKind | getArgKind (unsigned Idx) const |
Return the kind of the specified index. | |
const std::string & | getArgStdStr (unsigned Idx) const |
Return the provided argument string specified by Idx . | |
const char * | getArgCStr (unsigned Idx) const |
Return the specified C string argument. | |
int64_t | getArgSInt (unsigned Idx) const |
Return the specified signed integer argument. | |
uint64_t | getArgUInt (unsigned Idx) const |
Return the specified unsigned integer argument. | |
const IdentifierInfo * | getArgIdentifier (unsigned Idx) const |
Return the specified IdentifierInfo argument. | |
uint64_t | getRawArg (unsigned Idx) const |
Return the specified non-string argument in an opaque form. | |
unsigned | getNumRanges () const |
Return the number of source ranges associated with this diagnostic. | |
const CharSourceRange & | getRange (unsigned Idx) const |
ArrayRef< CharSourceRange > | getRanges () const |
Return an array reference for this diagnostic's ranges. | |
unsigned | getNumFixItHints () const |
const FixItHint & | getFixItHint (unsigned Idx) const |
ArrayRef< FixItHint > | getFixItHints () const |
StringRef | getFlagValue () const |
Return the value associated with this diagnostic flag. | |
void | FormatDiagnostic (SmallVectorImpl< char > &OutStr) const |
Format this diagnostic into a string, substituting the formal arguments into the %0 slots. | |
void | FormatDiagnostic (const char *DiagStr, const char *DiagEnd, SmallVectorImpl< char > &OutStr) const |
Format the given format-string into the output buffer using the arguments stored in this diagnostic. | |
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine and DiagnosticStorage) that allows clients to enquire about the diagnostic.
Definition at line 1512 of file Diagnostic.h.
Diagnostic::Diagnostic | ( | const DiagnosticsEngine * | DO, |
const DiagnosticBuilder & | DiagBuilder | ||
) |
Definition at line 697 of file Diagnostic.cpp.
Diagnostic::Diagnostic | ( | const DiagnosticsEngine * | DO, |
SourceLocation | DiagLoc, | ||
unsigned | DiagID, | ||
const DiagnosticStorage & | DiagStorage, | ||
StringRef | StoredDiagMessage | ||
) |
Definition at line 703 of file Diagnostic.cpp.
void Diagnostic::FormatDiagnostic | ( | const char * | DiagStr, |
const char * | DiagEnd, | ||
SmallVectorImpl< char > & | OutStr | ||
) | const |
Format the given format-string into the output buffer using the arguments stored in this diagnostic.
FormattedArgs - Keep track of all of the arguments formatted by ConvertArgToString and pass them into subsequent calls to ConvertArgToString, allowing the implementation to avoid redundancies in obvious cases.
QualTypeVals - Pass a vector of arrays so that QualType names can be compared to see if more information is needed to be printed.
Definition at line 1028 of file Diagnostic.cpp.
References clang::DiagnosticsEngine::ak_addrspace, clang::DiagnosticsEngine::ak_attr, clang::DiagnosticsEngine::ak_c_string, clang::DiagnosticsEngine::ak_declarationname, clang::DiagnosticsEngine::ak_declcontext, clang::DiagnosticsEngine::ak_identifierinfo, clang::DiagnosticsEngine::ak_nameddecl, clang::DiagnosticsEngine::ak_nestednamespec, clang::DiagnosticsEngine::ak_qual, clang::DiagnosticsEngine::ak_qualtype, clang::DiagnosticsEngine::ak_qualtype_pair, clang::DiagnosticsEngine::ak_sint, clang::DiagnosticsEngine::ak_std_string, clang::DiagnosticsEngine::ak_tokenkind, clang::DiagnosticsEngine::ak_uint, clang::DiagnosticsEngine::ConvertArgToString(), clang::TemplateDiffTypes::ElideType, clang::EscapeStringForDiagnostic(), FormatDiagnostic(), clang::TemplateDiffTypes::FromType, getArgCStr(), getArgIdentifier(), getArgKind(), getArgSInt(), getArgStdStr(), getArgUInt(), getDiags(), clang::tok::getKeywordSpelling(), clang::IdentifierInfo::getName(), getNumArgs(), clang::tok::getPunctuatorSpelling(), getRawArg(), getTokenDescForDiagnostic(), clang::tok::getTokenName(), HandleIntegerHumanModifier(), HandleIntegerSModifier(), HandleOrdinalModifier(), HandlePluralModifier(), HandleSelectModifier(), clang::isDigit(), clang::isPunctuation(), ModifierIs(), clang::Pipe, clang::TemplateDiffTypes::PrintFromType, clang::TemplateDiffTypes::PrintTree, ScanFormat(), clang::TemplateDiffTypes::ShowColors, clang::TemplateDiffTypes::TemplateDiffUsed, clang::TemplateDiffTypes::ToType, and Tree.
void Diagnostic::FormatDiagnostic | ( | SmallVectorImpl< char > & | OutStr | ) | const |
Format this diagnostic into a string, substituting the formal arguments into the %0 slots.
FormatDiagnostic - Format this diagnostic into a string, substituting the formal arguments into the %0 slots.
The result is appended onto the OutStr
array.
The result is appended onto the Str array.
Definition at line 970 of file Diagnostic.cpp.
References Diag(), FormatDiagnostic(), clang::DiagnosticsEngine::getDiagnosticIDs(), getDiags(), and getID().
Referenced by clang::PartialDiagnostic::EmitToString(), FormatDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticBuffer::HandleDiagnostic(), clang::format::FatalDiagnosticConsumer::HandleDiagnostic(), clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), HandlePluralModifier(), HandleSelectModifier(), and clang::StoredDiagnostic::StoredDiagnostic().
|
inline |
Return the specified C string argument.
Definition at line 1555 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_c_string, clang::DiagnosticStorage::DiagArgumentsVal, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Return the specified IdentifierInfo argument.
Definition at line 1579 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_identifierinfo, clang::DiagnosticStorage::DiagArgumentsVal, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Return the kind of the specified index.
Based on the kind of argument, the accessors below can be used to get the value.
Definition at line 1540 of file Diagnostic.h.
References clang::DiagnosticStorage::DiagArgumentsKind, and getNumArgs().
Referenced by FormatDiagnostic(), getArgCStr(), getArgIdentifier(), getArgSInt(), getArgStdStr(), getArgUInt(), and getRawArg().
|
inline |
Return the specified signed integer argument.
Definition at line 1563 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_sint, clang::DiagnosticStorage::DiagArgumentsVal, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Return the provided argument string specified by Idx
.
Definition at line 1547 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_std_string, clang::DiagnosticStorage::DiagArgumentsStr, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Return the specified unsigned integer argument.
Definition at line 1571 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_uint, clang::DiagnosticStorage::DiagArgumentsVal, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Definition at line 1526 of file Diagnostic.h.
Referenced by FormatDiagnostic().
Definition at line 1608 of file Diagnostic.h.
References clang::DiagnosticStorage::FixItHints, and getNumFixItHints().
Referenced by clang::FixItRewriter::HandleDiagnostic().
Definition at line 1613 of file Diagnostic.h.
References clang::DiagnosticStorage::FixItHints.
Referenced by clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
|
inline |
Return the value associated with this diagnostic flag.
Definition at line 1616 of file Diagnostic.h.
Referenced by printDiagnosticOptions().
|
inline |
Definition at line 1527 of file Diagnostic.h.
Referenced by clang::DiagnosticsEngine::EmitDiagnostic(), clang::Sema::EmitDiagnostic(), FormatDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), and printDiagnosticOptions().
|
inline |
Definition at line 1528 of file Diagnostic.h.
Referenced by clang::DiagnosticsEngine::EmitDiagnostic(), clang::Sema::EmitDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticBuffer::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::FixItRewriter::HandleDiagnostic(), clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
|
inline |
Definition at line 1532 of file Diagnostic.h.
References clang::DiagnosticStorage::NumDiagArgs.
Referenced by FormatDiagnostic(), and getArgKind().
|
inline |
Definition at line 1606 of file Diagnostic.h.
References clang::DiagnosticStorage::FixItHints.
Referenced by getFixItHint(), and clang::FixItRewriter::HandleDiagnostic().
|
inline |
Return the number of source ranges associated with this diagnostic.
Definition at line 1595 of file Diagnostic.h.
References clang::DiagnosticStorage::DiagRanges.
Referenced by getRange().
|
inline |
Definition at line 1598 of file Diagnostic.h.
References clang::DiagnosticStorage::DiagRanges, and getNumRanges().
|
inline |
Return an array reference for this diagnostic's ranges.
Definition at line 1604 of file Diagnostic.h.
References clang::DiagnosticStorage::DiagRanges.
Referenced by clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
|
inline |
Return the specified non-string argument in an opaque form.
Definition at line 1588 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_std_string, clang::DiagnosticStorage::DiagArgumentsVal, and getArgKind().
Referenced by FormatDiagnostic().
|
inline |
Definition at line 1530 of file Diagnostic.h.
References clang::DiagnosticsEngine::getSourceManager().
Referenced by clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
|
inline |
Definition at line 1529 of file Diagnostic.h.
References clang::DiagnosticsEngine::hasSourceManager().
Referenced by clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::SARIFDiagnosticPrinter::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().