clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::DiagnosticIDs Class Reference

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

#include <DiagnosticIDs.h>

Inheritance diagram for clang::DiagnosticIDs:
Inheritance graph
[legend]
Collaboration diagram for clang::DiagnosticIDs:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Level {
  Ignored, Note, Warning, Error,
  Fatal
}
 Level - 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 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 Message)
StringRef getDescription (unsigned DiagID) const
bool getDiagnosticsInGroup (StringRef Group, llvm::SmallVectorImpl< diag::kind > &Diags) const
 Get the set of all diagnostic IDs in the group with the given name.
void getAllDiagnostics (llvm::SmallVectorImpl< diag::kind > &Diags) const
 Get the set of all diagnostic IDs.

Static Public Member Functions

static bool isBuiltinWarningOrExtension (unsigned DiagID)
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)
static bool isBuiltinExtensionDiag (unsigned DiagID, bool &EnabledByDefault)
static StringRef getWarningOptionForDiag (unsigned DiagID)
static unsigned getCategoryNumberForDiag (unsigned DiagID)
static unsigned getNumberOfCategories ()
 getNumberOfCategories - Return the number of categories
static StringRef getCategoryNameFromID (unsigned CategoryID)
static bool isARCDiagnostic (unsigned DiagID)
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 getNearestWarningOption (StringRef Group)
 Get the warning option with the closest edit distance to the given group name.

Friends

class DiagnosticsEngine

Detailed Description

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

Definition at line 112 of file DiagnosticIDs.h.


Member Enumeration Documentation

Level - The level of the diagnostic, after it has been through mapping.

Enumerator:
Ignored 
Note 
Warning 
Error 
Fatal 

Definition at line 115 of file DiagnosticIDs.h.

Enumeration describing how the the emission of a diagnostic should be treated when it occurs during C++ template argument deduction.

Enumerator:
SFINAE_SubstitutionFailure 

The diagnostic should not be reported, but it should cause template argument deduction to fail.

The vast majority of errors that occur during template argument deduction fall into this category.

SFINAE_Suppress 

The diagnostic should be suppressed entirely.

Warnings generally fall into this category.

SFINAE_Report 

The diagnostic should be reported.

The diagnostic should be reported. Various fatal errors (e.g., template instantiation depth exceeded) fall into this category.

SFINAE_AccessControl 

The diagnostic is an access-control diagnostic, which will be substitution failures in some contexts and reported in others.

Definition at line 192 of file DiagnosticIDs.h.


Constructor & Destructor Documentation

DiagnosticIDs::DiagnosticIDs ( )

Definition at line 284 of file DiagnosticIDs.cpp.

DiagnosticIDs::~DiagnosticIDs ( )

Definition at line 288 of file DiagnosticIDs.cpp.


Member Function Documentation

void DiagnosticIDs::getAllDiagnostics ( llvm::SmallVectorImpl< diag::kind > &  Diags) const

Get the set of all diagnostic IDs.

Definition at line 546 of file DiagnosticIDs.cpp.

References StaticDiagInfo, and StaticDiagInfoSize.

StringRef DiagnosticIDs::getCategoryNameFromID ( unsigned  CategoryID) [static]

getCategoryNameFromID - 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 198 of file DiagnosticIDs.cpp.

References getNumberOfCategories().

Referenced by isARCDiagnostic(), PrintDiagnosticCategories(), printDiagnosticOptions(), and clang::arcmt::writeARCDiagsToPlist().

unsigned DiagnosticIDs::getCategoryNumberForDiag ( unsigned  DiagID) [static]

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

Definition at line 148 of file DiagnosticIDs.cpp.

References GetDiagInfo().

Referenced by isARCDiagnostic(), printDiagnosticOptions(), and clang::arcmt::writeARCDiagsToPlist().

unsigned DiagnosticIDs::getCustomDiagID ( Level  L,
StringRef  Message 
)

getCustomDiagID - Return an ID for a diagnostic with the specified message and level. If this is the first request for this diagnosic, it is registered and created, otherwise the existing ID is returned.

Definition at line 295 of file DiagnosticIDs.cpp.

References clang::diag::CustomDiagInfo::getOrCreateDiagID().

StringRef DiagnosticIDs::getDescription ( unsigned  DiagID) const

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

Definition at line 343 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 207 of file DiagnosticIDs.cpp.

References GetDiagInfo(), SFINAE_AccessControl, SFINAE_Report, SFINAE_SubstitutionFailure, and SFINAE_Suppress.

Referenced by clang::Sema::EmitCurrentDiagnostic().

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

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

Parameters:
Diags[out] - On return, the diagnostics in the group.
Returns:
True if the given group is unknown, false otherwise.

Definition at line 530 of file DiagnosticIDs.cpp.

References clang::WarningOption::getName(), and WarningOptionCompare().

StringRef DiagnosticIDs::getNearestWarningOption ( StringRef  Group) [static]

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

Definition at line 552 of file DiagnosticIDs.cpp.

Referenced by EmitUnknownDiagWarning().

unsigned DiagnosticIDs::getNumberOfCategories ( ) [static]

getNumberOfCategories - Return the number of categories

Definition at line 191 of file DiagnosticIDs.cpp.

References CategoryNameTable.

Referenced by getCategoryNameFromID(), and PrintDiagnosticCategories().

StringRef DiagnosticIDs::getWarningOptionForDiag ( unsigned  DiagID) [static]

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 507 of file DiagnosticIDs.cpp.

References GetDiagInfo(), and clang::WarningOption::getName().

Referenced by printDiagnosticOptions().

bool DiagnosticIDs::isARCDiagnostic ( unsigned  DiagID) [static]

isARCDiagnostic - Return true if a given diagnostic falls into an ARC diagnostic category;

Definition at line 693 of file DiagnosticIDs.cpp.

References getCategoryNameFromID(), and getCategoryNumberForDiag().

static bool clang::DiagnosticIDs::isBuiltinExtensionDiag ( unsigned  DiagID) [inline, static]

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

Definition at line 157 of file DiagnosticIDs.h.

Referenced by printDiagnosticOptions().

bool DiagnosticIDs::isBuiltinExtensionDiag ( unsigned  DiagID,
bool &  EnabledByDefault 
) [static]

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 323 of file DiagnosticIDs.cpp.

References clang::diag::DIAG_UPPER_LIMIT, getBuiltinDiagClass(), GetDefaultDiagMappingInfo(), clang::DiagnosticMappingInfo::getMapping(), and clang::diag::MAP_IGNORE.

bool DiagnosticIDs::isBuiltinNote ( unsigned  DiagID) [static]

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

Definition at line 313 of file DiagnosticIDs.cpp.

References clang::diag::DIAG_UPPER_LIMIT, and getBuiltinDiagClass().

Referenced by clang::Sema::EmitCurrentDiagnostic().

bool DiagnosticIDs::isBuiltinWarningOrExtension ( unsigned  DiagID) [static]

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 306 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 334 of file DiagnosticIDs.cpp.

References clang::diag::DIAG_UPPER_LIMIT, GetDefaultDiagMappingInfo(), clang::DiagnosticMappingInfo::getMapping(), and clang::diag::MAP_ERROR.

Referenced by printDiagnosticOptions().


Friends And Related Function Documentation

friend class DiagnosticsEngine [friend]

Definition at line 274 of file DiagnosticIDs.h.


The documentation for this class was generated from the following files: