clang API Documentation
#include <Diagnostic.h>
Public Member Functions | |
Diagnostic (const DiagnosticsEngine *DO) | |
Diagnostic (const DiagnosticsEngine *DO, 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. | |
int | getArgSInt (unsigned Idx) const |
Return the specified signed integer argument. | |
unsigned | getArgUInt (unsigned Idx) const |
Return the specified unsigned integer argument. | |
const IdentifierInfo * | getArgIdentifier (unsigned Idx) const |
Return the specified IdentifierInfo argument. | |
intptr_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 |
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) that allows clients to enquire about the currently in-flight diagnostic.
Definition at line 1122 of file Diagnostic.h.
clang::Diagnostic::Diagnostic | ( | const DiagnosticsEngine * | DO | ) | [inline, explicit] |
Definition at line 1126 of file Diagnostic.h.
clang::Diagnostic::Diagnostic | ( | const DiagnosticsEngine * | DO, |
StringRef | storedDiagMessage | ||
) | [inline] |
Definition at line 1127 of file Diagnostic.h.
void Diagnostic::FormatDiagnostic | ( | SmallVectorImpl< char > & | OutStr | ) | const |
Format this diagnostic into a string, substituting the formal arguments into the %0 slots.
The result is appended onto the OutStr
array.
FormatDiagnostic - Format this diagnostic into a string, substituting the formal arguments into the %0 slots. The result is appended onto the Str array.
Definition at line 610 of file Diagnostic.cpp.
References Diag(), clang::DiagnosticsEngine::getDiagnosticIDs(), getDiags(), and getID().
Referenced by clang::PartialDiagnostic::EmitToString(), FormatDiagnostic(), clang::TextDiagnosticBuffer::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), HandlePluralModifier(), HandleSelectModifier(), and clang::StoredDiagnostic::StoredDiagnostic().
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 623 of file Diagnostic.cpp.
References clang::DiagnosticsEngine::ak_attr, clang::DiagnosticsEngine::ak_c_string, clang::DiagnosticsEngine::ak_declarationname, clang::DiagnosticsEngine::ak_declcontext, clang::DiagnosticsEngine::ak_nameddecl, clang::DiagnosticsEngine::ak_nestednamespec, 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, FormatDiagnostic(), clang::TemplateDiffTypes::FromType, getArgCStr(), getArgKind(), getArgSInt(), getArgStdStr(), getArgUInt(), getDiags(), clang::tok::getKeywordSpelling(), getNumArgs(), clang::tok::getPunctuatorSpelling(), getRawArg(), getTokenDescForDiagnostic(), clang::tok::getTokenName(), HandleIntegerSModifier(), HandleOrdinalModifier(), HandlePluralModifier(), HandleSelectModifier(), clang::isDigit(), clang::isPunctuation(), ModifierIs(), clang::TemplateDiffTypes::PrintFromType, clang::TemplateDiffTypes::PrintTree, S, ScanFormat(), clang::TemplateDiffTypes::ShowColors, clang::TemplateDiffTypes::TemplateDiffUsed, and clang::TemplateDiffTypes::ToType.
const char* clang::Diagnostic::getArgCStr | ( | unsigned | Idx | ) | const [inline] |
Return the specified C string argument.
Definition at line 1159 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_c_string, and getArgKind().
Referenced by FormatDiagnostic().
const IdentifierInfo* clang::Diagnostic::getArgIdentifier | ( | unsigned | Idx | ) | const [inline] |
Return the specified IdentifierInfo argument.
Definition at line 1183 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_identifierinfo, and getArgKind().
DiagnosticsEngine::ArgumentKind clang::Diagnostic::getArgKind | ( | unsigned | Idx | ) | const [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 1144 of file Diagnostic.h.
References getNumArgs().
Referenced by FormatDiagnostic(), getArgCStr(), getArgIdentifier(), getArgSInt(), getArgStdStr(), getArgUInt(), getRawArg(), and clang::PartialDiagnostic::PartialDiagnostic().
int clang::Diagnostic::getArgSInt | ( | unsigned | Idx | ) | const [inline] |
Return the specified signed integer argument.
Definition at line 1167 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_sint, and getArgKind().
Referenced by FormatDiagnostic().
const std::string& clang::Diagnostic::getArgStdStr | ( | unsigned | Idx | ) | const [inline] |
Return the provided argument string specified by Idx
.
Definition at line 1151 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_std_string, and getArgKind().
Referenced by FormatDiagnostic(), clang::tooling::UnusedInputDiagConsumer::HandleDiagnostic(), and clang::PartialDiagnostic::PartialDiagnostic().
unsigned clang::Diagnostic::getArgUInt | ( | unsigned | Idx | ) | const [inline] |
Return the specified unsigned integer argument.
Definition at line 1175 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_uint, and getArgKind().
Referenced by FormatDiagnostic().
const DiagnosticsEngine* clang::Diagnostic::getDiags | ( | ) | const [inline] |
Definition at line 1130 of file Diagnostic.h.
Referenced by FormatDiagnostic(), and printDiagnosticOptions().
const FixItHint& clang::Diagnostic::getFixItHint | ( | unsigned | Idx | ) | const [inline] |
Definition at line 1217 of file Diagnostic.h.
References getNumFixItHints().
Referenced by clang::FixItRewriter::HandleDiagnostic(), clang::PartialDiagnostic::PartialDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
ArrayRef<FixItHint> clang::Diagnostic::getFixItHints | ( | ) | const [inline] |
Definition at line 1222 of file Diagnostic.h.
Referenced by clang::TextDiagnosticPrinter::HandleDiagnostic().
unsigned clang::Diagnostic::getID | ( | ) | const [inline] |
Definition at line 1131 of file Diagnostic.h.
Referenced by clang::DiagnosticsEngine::EmitCurrentDiagnostic(), FormatDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::tooling::UnusedInputDiagConsumer::HandleDiagnostic(), and printDiagnosticOptions().
const SourceLocation& clang::Diagnostic::getLocation | ( | ) | const [inline] |
Definition at line 1132 of file Diagnostic.h.
Referenced by clang::DiagnosticsEngine::EmitCurrentDiagnostic(), clang::Sema::EmitCurrentDiagnostic(), clang::TextDiagnosticBuffer::HandleDiagnostic(), clang::TextDiagnosticPrinter::HandleDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::FixItRewriter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
unsigned clang::Diagnostic::getNumArgs | ( | ) | const [inline] |
Definition at line 1136 of file Diagnostic.h.
Referenced by FormatDiagnostic(), getArgKind(), and clang::PartialDiagnostic::PartialDiagnostic().
unsigned clang::Diagnostic::getNumFixItHints | ( | ) | const [inline] |
Definition at line 1213 of file Diagnostic.h.
Referenced by getFixItHint(), clang::FixItRewriter::HandleDiagnostic(), clang::PartialDiagnostic::PartialDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
unsigned clang::Diagnostic::getNumRanges | ( | ) | const [inline] |
Return the number of source ranges associated with this diagnostic.
Definition at line 1198 of file Diagnostic.h.
Referenced by getRange(), clang::PartialDiagnostic::PartialDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
const CharSourceRange& clang::Diagnostic::getRange | ( | unsigned | Idx | ) | const [inline] |
Definition at line 1203 of file Diagnostic.h.
References getNumRanges().
Referenced by clang::PartialDiagnostic::PartialDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
ArrayRef<CharSourceRange> clang::Diagnostic::getRanges | ( | ) | const [inline] |
Return an array reference for this diagnostic's ranges.
Definition at line 1209 of file Diagnostic.h.
Referenced by clang::TextDiagnosticPrinter::HandleDiagnostic().
intptr_t clang::Diagnostic::getRawArg | ( | unsigned | Idx | ) | const [inline] |
Return the specified non-string argument in an opaque form.
Definition at line 1191 of file Diagnostic.h.
References clang::DiagnosticsEngine::ak_std_string, and getArgKind().
Referenced by FormatDiagnostic(), and clang::PartialDiagnostic::PartialDiagnostic().
SourceManager& clang::Diagnostic::getSourceManager | ( | ) | const [inline] |
Definition at line 1134 of file Diagnostic.h.
References clang::DiagnosticsEngine::getSourceManager().
Referenced by clang::TextDiagnosticPrinter::HandleDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().
bool clang::Diagnostic::hasSourceManager | ( | ) | const [inline] |
Definition at line 1133 of file Diagnostic.h.
References clang::DiagnosticsEngine::hasSourceManager().
Referenced by clang::TextDiagnosticPrinter::HandleDiagnostic(), clang::LogDiagnosticPrinter::HandleDiagnostic(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), and clang::StoredDiagnostic::StoredDiagnostic().