clang API Documentation
Used for handling and querying diagnostic IDs. More...
#include <DiagnosticIDs.h>
Public Types | |
enum | Level { Ignored, Note, Remark, Warning, Error, Fatal } |
The level of the diagnostic, after it has been through mapping. More... | |
enum | SFINAEResponse { SFINAE_SubstitutionFailure, SFINAE_Suppress, SFINAE_Report, SFINAE_AccessControl } |
Enumeration describing how the emission of a diagnostic should be treated when it occurs during C++ template argument deduction. More... | |
Public Member Functions | |
DiagnosticIDs () | |
~DiagnosticIDs () | |
unsigned | getCustomDiagID (Level L, StringRef FormatString) |
Return an ID for a diagnostic with the specified format string and level. | |
StringRef | getDescription (unsigned DiagID) const |
Given a diagnostic ID, return a description of the issue. | |
bool | getDiagnosticsInGroup (diag::Flavor Flavor, StringRef Group, SmallVectorImpl< diag::kind > &Diags) const |
Get the set of all diagnostic IDs in the group with the given name. | |
void | getAllDiagnostics (diag::Flavor Flavor, SmallVectorImpl< diag::kind > &Diags) const |
Get the set of all diagnostic IDs. | |
Static Public Member Functions | |
static bool | isBuiltinWarningOrExtension (unsigned DiagID) |
Return true if the unmapped diagnostic levelof the specified diagnostic ID is a Warning or Extension. | |
static bool | isDefaultMappingAsError (unsigned DiagID) |
Return true if the specified diagnostic is mapped to errors by default. | |
static bool | isBuiltinNote (unsigned DiagID) |
Determine whether the given built-in diagnostic ID is a Note. | |
static bool | isBuiltinExtensionDiag (unsigned DiagID) |
Determine whether the given built-in diagnostic ID is for an extension of some sort. | |
static bool | isBuiltinExtensionDiag (unsigned DiagID, bool &EnabledByDefault) |
Determine whether the given built-in diagnostic ID is for an extension of some sort, and whether it is enabled by default. | |
static StringRef | getWarningOptionForDiag (unsigned DiagID) |
Return the lowest-level warning option that enables the specified diagnostic. | |
static unsigned | getCategoryNumberForDiag (unsigned DiagID) |
Return the category number that a specified DiagID belongs to, or 0 if no category. | |
static unsigned | getNumberOfCategories () |
Return the number of diagnostic categories. | |
static StringRef | getCategoryNameFromID (unsigned CategoryID) |
Given a category ID, return the name of the category. | |
static bool | isARCDiagnostic (unsigned DiagID) |
Return true if a given diagnostic falls into an ARC diagnostic category. | |
static SFINAEResponse | getDiagnosticSFINAEResponse (unsigned DiagID) |
Determines whether the given built-in diagnostic ID is for an error that is suppressed if it occurs during C++ template argument deduction. | |
static StringRef | getNearestOption (diag::Flavor Flavor, StringRef Group) |
Get the diagnostic option with the closest edit distance to the given group name. | |
Friends | |
class | DiagnosticsEngine |
Used for handling and querying diagnostic IDs.
Can be used and shared by multiple Diagnostics for multiple translation units.
Definition at line 116 of file DiagnosticIDs.h.
The level of the diagnostic, after it has been through mapping.
Definition at line 119 of file DiagnosticIDs.h.
Enumeration describing how the emission of a diagnostic should be treated when it occurs during C++ template argument deduction.
Definition at line 202 of file DiagnosticIDs.h.
Definition at line 303 of file DiagnosticIDs.cpp.
Definition at line 305 of file DiagnosticIDs.cpp.
void DiagnosticIDs::getAllDiagnostics | ( | diag::Flavor | Flavor, |
SmallVectorImpl< diag::kind > & | Diags | ||
) | const |
Get the set of all diagnostic IDs.
Definition at line 565 of file DiagnosticIDs.cpp.
References StaticDiagInfo, and StaticDiagInfoSize.
StringRef DiagnosticIDs::getCategoryNameFromID | ( | unsigned | CategoryID | ) | [static] |
Given a category ID, return the name of the category.
getCategoryNameFromID - Given a category ID, return the name of the category, an empty string if CategoryID is zero, or null if CategoryID is invalid.
Definition at line 229 of file DiagnosticIDs.cpp.
References getNumberOfCategories().
Referenced by isARCDiagnostic(), PrintDiagnosticCategories(), printDiagnosticOptions(), and clang::arcmt::writeARCDiagsToPlist().
unsigned DiagnosticIDs::getCategoryNumberForDiag | ( | unsigned | DiagID | ) | [static] |
Return the category number that a specified DiagID
belongs to, or 0 if no category.
getCategoryNumberForDiag - Return the category number that a specified DiagID belongs to, or 0 if no category.
Definition at line 180 of file DiagnosticIDs.cpp.
References GetDiagInfo().
Referenced by isARCDiagnostic(), printDiagnosticOptions(), and clang::arcmt::writeARCDiagsToPlist().
unsigned DiagnosticIDs::getCustomDiagID | ( | Level | L, |
StringRef | FormatString | ||
) |
Return an ID for a diagnostic with the specified format string and level.
If this is the first request for this diagnostic, it is registered and created, otherwise the existing ID is returned.
getCustomDiagID - Return an ID for a diagnostic with the specified message and level. If this is the first request for this diagnostic, it is registered and created, otherwise the existing ID is returned.
FormatString | A fixed diagnostic format string that will be hashed and mapped to a unique DiagID. |
Definition at line 315 of file DiagnosticIDs.cpp.
References clang::diag::CustomDiagInfo::getOrCreateDiagID().
StringRef DiagnosticIDs::getDescription | ( | unsigned | DiagID | ) | const |
Given a diagnostic ID, return a description of the issue.
getDescription - Given a diagnostic ID, return a description of the issue.
Definition at line 363 of file DiagnosticIDs.cpp.
References clang::diag::CustomDiagInfo::getDescription(), and GetDiagInfo().
DiagnosticIDs::SFINAEResponse DiagnosticIDs::getDiagnosticSFINAEResponse | ( | unsigned | DiagID | ) | [static] |
Determines whether the given built-in diagnostic ID is for an error that is suppressed if it occurs during C++ template argument deduction.
When an error is suppressed due to SFINAE, the template argument deduction fails but no diagnostic is emitted. Certain classes of errors, such as those errors that involve C++ access control, are not SFINAE errors.
Definition at line 238 of file DiagnosticIDs.cpp.
References GetDiagInfo(), and SFINAE_Report.
Referenced by clang::Sema::EmitCurrentDiagnostic().
bool DiagnosticIDs::getDiagnosticsInGroup | ( | diag::Flavor | Flavor, |
StringRef | Group, | ||
SmallVectorImpl< diag::kind > & | Diags | ||
) | const |
Get the set of all diagnostic IDs in the group with the given name.
[out] | Diags | - On return, the diagnostics in the group. |
true
if the given group is unknown, false
otherwise. Definition at line 554 of file DiagnosticIDs.cpp.
References WarningOptionCompare().
Referenced by getNearestOption().
StringRef DiagnosticIDs::getNearestOption | ( | diag::Flavor | Flavor, |
StringRef | Group | ||
) | [static] |
Get the diagnostic option with the closest edit distance to the given group name.
Definition at line 572 of file DiagnosticIDs.cpp.
References getDiagnosticsInGroup().
Referenced by EmitUnknownDiagWarning().
unsigned DiagnosticIDs::getNumberOfCategories | ( | ) | [static] |
Return the number of diagnostic categories.
getNumberOfCategories - Return the number of categories
Definition at line 222 of file DiagnosticIDs.cpp.
Referenced by getCategoryNameFromID(), and PrintDiagnosticCategories().
StringRef DiagnosticIDs::getWarningOptionForDiag | ( | unsigned | DiagID | ) | [static] |
Return the lowest-level warning option that enables the specified diagnostic.
If there is no -Wfoo flag that controls the diagnostic, this returns null.
getWarningOptionForDiag - Return the lowest-level warning option that enables the specified diagnostic. If there is no -Wfoo flag that controls the diagnostic, this returns null.
Definition at line 517 of file DiagnosticIDs.cpp.
References GetDiagInfo().
Referenced by clang::LogDiagnosticPrinter::HandleDiagnostic(), and printDiagnosticOptions().
bool DiagnosticIDs::isARCDiagnostic | ( | unsigned | DiagID | ) | [static] |
Return true if a given diagnostic falls into an ARC diagnostic category.
Definition at line 717 of file DiagnosticIDs.cpp.
References getCategoryNameFromID(), and getCategoryNumberForDiag().
static bool clang::DiagnosticIDs::isBuiltinExtensionDiag | ( | unsigned | DiagID | ) | [inline, static] |
Determine whether the given built-in diagnostic ID is for an extension of some sort.
Definition at line 165 of file DiagnosticIDs.h.
bool DiagnosticIDs::isBuiltinExtensionDiag | ( | unsigned | DiagID, |
bool & | EnabledByDefault | ||
) | [static] |
Determine whether the given built-in diagnostic ID is for an extension of some sort, and whether it is enabled by default.
This also returns EnabledByDefault, which is set to indicate whether the diagnostic is ignored by default (in which case -pedantic enables it) or treated as a warning/error by default.
isBuiltinExtensionDiag - Determine whether the given built-in diagnostic ID is for an extension of some sort. This also returns EnabledByDefault, which is set to indicate whether the diagnostic is ignored by default (in which case -pedantic enables it) or treated as a warning/error by default.
Definition at line 343 of file DiagnosticIDs.cpp.
References clang::diag::DIAG_UPPER_LIMIT, getBuiltinDiagClass(), GetDefaultDiagMapping(), clang::DiagnosticMapping::getSeverity(), and Ignored.
bool DiagnosticIDs::isBuiltinNote | ( | unsigned | DiagID | ) | [static] |
Determine whether the given built-in diagnostic ID is a Note.
Definition at line 333 of file DiagnosticIDs.cpp.
References clang::diag::DIAG_UPPER_LIMIT, and getBuiltinDiagClass().
Referenced by clang::Sema::EmitCurrentDiagnostic().
bool DiagnosticIDs::isBuiltinWarningOrExtension | ( | unsigned | DiagID | ) | [static] |
Return true if the unmapped diagnostic levelof the specified diagnostic ID is a Warning or Extension.
This only works on builtin diagnostics, not custom ones, and is not legal to call on NOTEs.
isBuiltinWarningOrExtension - Return true if the unmapped diagnostic level of the specified diagnostic ID is a Warning or Extension. This only works on builtin diagnostics, not custom ones, and is not legal to call on NOTEs.
Definition at line 326 of file DiagnosticIDs.cpp.
References clang::diag::DIAG_UPPER_LIMIT, and getBuiltinDiagClass().
Referenced by printDiagnosticOptions().
bool DiagnosticIDs::isDefaultMappingAsError | ( | unsigned | DiagID | ) | [static] |
Return true if the specified diagnostic is mapped to errors by default.
Definition at line 354 of file DiagnosticIDs.cpp.
References clang::diag::DIAG_UPPER_LIMIT, Error, GetDefaultDiagMapping(), and clang::DiagnosticMapping::getSeverity().
Referenced by printDiagnosticOptions().
friend class DiagnosticsEngine [friend] |
Definition at line 282 of file DiagnosticIDs.h.