class DiagnosticIDs

Declaration

class DiagnosticIDs : public RefCountedBase { /* full declaration omitted */ };

Description

Used for handling and querying diagnostic IDs. Can be used and shared by multiple Diagnostics for multiple translation units.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:166

Inherits from: RefCountedBase

Member Variables

private std::unique_ptr<diag::CustomDiagInfo> CustomDiagInfo
Information for uniquing and looking up custom diags.

Method Overview

Methods

DiagnosticIDs()

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:178

void EmitDiag(
    clang::DiagnosticsEngine& Diag,
    clang::DiagnosticIDs::Level DiagLevel) const

Description

Used to emit a diagnostic that is finally fully formed, ignoring suppression.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:355

Parameters

clang::DiagnosticsEngine& Diag
clang::DiagnosticIDs::Level DiagLevel

bool ProcessDiag(
    clang::DiagnosticsEngine& Diag) const

Description

Used to report a diagnostic that is finally fully formed.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:351

Parameters

clang::DiagnosticsEngine& Diag

Returns

\c true if the diagnostic was emitted, \c false if it was suppressed.

static void getAllDiagnostics(
    diag::Flavor Flavor,
    std::vector<diag::kind>& Diags)

Description

Get the set of all diagnostic IDs.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:323

Parameters

diag::Flavor Flavor
std::vector<diag::kind>& Diags

static llvm::StringRef getCategoryNameFromID(
    unsigned int CategoryID)

Description

Given a category ID, return the name of the category.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:259

Parameters

unsigned int CategoryID

static unsigned int getCategoryNumberForDiag(
    unsigned int DiagID)

Description

Return the category number that a specified \p DiagID belongs to, or 0 if no category.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:253

Parameters

unsigned int DiagID

unsigned int getCustomDiagID(
    clang::DiagnosticIDs::Level L,
    llvm::StringRef FormatString)

Description

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.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:190

Parameters

clang::DiagnosticIDs::Level L
llvm::StringRef FormatString

llvm::StringRef getDescription(
    unsigned int DiagID) const

Description

Given a diagnostic ID, return a description of the issue.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:197

Parameters

unsigned int DiagID

static std::vector<std::string>
getDiagnosticFlags()

Description

Get the string of all diagnostic flags.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:313

Returns

A list of all diagnostics flags as they would be written in a command line invocation including their `no-` variants. For example: `{"-Wempty-body", "-Wno-empty-body", ...}`

DiagnosticIDs::Level getDiagnosticLevel(
    unsigned int DiagID,
    clang::SourceLocation Loc,
    const clang::DiagnosticsEngine& Diag) const

Description

Classify the specified diagnostic ID into a Level, consumable by the DiagnosticClient. The classification is based on the way the client configured the DiagnosticsEngine object.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:340

Parameters

unsigned int DiagID
clang::SourceLocation Loc
The source location for which we are interested in finding out the diagnostic state. Can be null in order to query the latest state.
const clang::DiagnosticsEngine& Diag

static clang::DiagnosticIDs::SFINAEResponse
getDiagnosticSFINAEResponse(unsigned int DiagID)

Description

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.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:299

Parameters

unsigned int DiagID

diag::Severity getDiagnosticSeverity(
    unsigned int DiagID,
    clang::SourceLocation Loc,
    const clang::DiagnosticsEngine& Diag) const

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:344

Parameters

unsigned int DiagID
clang::SourceLocation Loc
const clang::DiagnosticsEngine& Diag

bool getDiagnosticsInGroup(
    diag::Flavor Flavor,
    llvm::StringRef Group,
    SmallVectorImpl<diag::kind>& Diags) const

Description

Get the set of all diagnostic IDs in the group with the given name.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:319

Parameters

diag::Flavor Flavor
llvm::StringRef Group
SmallVectorImpl<diag::kind>& Diags
- On return, the diagnostics in the group.

Returns

\c true if the given group is unknown, \c false otherwise.

static llvm::Optional<diag::Group>
getGroupForDiag(unsigned int DiagID)

Description

Return the lowest-level group that contains the specified diagnostic.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:243

Parameters

unsigned int DiagID

static llvm::Optional<diag::Group>
getGroupForWarningOption(llvm::StringRef)

Description

Given a group ID, returns the flag that toggles the group. For example, for "deprecated-declarations", returns Group::DeprecatedDeclarations.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:240

Parameters

llvm::StringRef

static llvm::StringRef getNearestOption(
    diag::Flavor Flavor,
    llvm::StringRef Group)

Description

Get the diagnostic option with the closest edit distance to the given group name.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:328

Parameters

diag::Flavor Flavor
llvm::StringRef Group

static unsigned int getNumberOfCategories()

Description

Return the number of diagnostic categories.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:256

static llvm::StringRef
getWarningOptionDocumentation(diag::Group GroupID)

Description

Given a diagnostic group ID, return its documentation.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:235

Parameters

diag::Group GroupID

static llvm::StringRef getWarningOptionForDiag(
    unsigned int DiagID)

Description

Return the lowest-level warning option that enables the specified diagnostic. If there is no -Wfoo flag that controls the diagnostic, this returns null.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:249

Parameters

unsigned int DiagID

static llvm::StringRef getWarningOptionForGroup(
    diag::Group)

Description

Given a group ID, returns the flag that toggles the group. For example, for Group::DeprecatedDeclarations, returns "deprecated-declarations".

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:232

Parameters

diag::Group

static bool isARCDiagnostic(unsigned int DiagID)

Description

Return true if a given diagnostic falls into an ARC diagnostic category.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:263

Parameters

unsigned int DiagID

static bool isBuiltinExtensionDiag(
    unsigned int DiagID,
    bool& EnabledByDefault)

Description

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.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:227

Parameters

unsigned int DiagID
bool& EnabledByDefault

static bool isBuiltinExtensionDiag(
    unsigned int DiagID)

Description

Determine whether the given built-in diagnostic ID is for an extension of some sort.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:215

Parameters

unsigned int DiagID

static bool isBuiltinNote(unsigned int DiagID)

Description

Determine whether the given built-in diagnostic ID is a Note.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:211

Parameters

unsigned int DiagID

static bool isBuiltinWarningOrExtension(
    unsigned int DiagID)

Description

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.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:204

Parameters

unsigned int DiagID

static bool isDefaultMappingAsError(
    unsigned int DiagID)

Description

Return true if the specified diagnostic is mapped to errors by default.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:208

Parameters

unsigned int DiagID

static bool isDeferrable(unsigned int DiagID)

Description

Whether the diagnostic message can be deferred. For single source offloading languages, a diagnostic message occurred in a device host function may be deferred until the function is sure to be emitted.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:306

Parameters

unsigned int DiagID

bool isUnrecoverable(unsigned int DiagID) const

Description

Whether the diagnostic may leave the AST in a state where some invariants can break.

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:359

Parameters

unsigned int DiagID

~DiagnosticIDs()

Declared at: clang/include/clang/Basic/DiagnosticIDs.h:179