Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Basic/DiagnosticIDs.cpp
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | |||||
#include "clang/Basic/DiagnosticAnalysisKinds.inc" | #include "clang/Basic/DiagnosticAnalysisKinds.inc" | ||||
#include "clang/Basic/DiagnosticRefactoringKinds.inc" | #include "clang/Basic/DiagnosticRefactoringKinds.inc" | ||||
// clang-format on | // clang-format on | ||||
#undef DIAG | #undef DIAG | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
static const unsigned StaticDiagInfoSize = llvm::array_lengthof(StaticDiagInfo); | static const unsigned StaticDiagInfoSize = std::size(StaticDiagInfo); | ||||
/// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID, | /// GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID, | ||||
/// or null if the ID is invalid. | /// or null if the ID is invalid. | ||||
static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { | static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { | ||||
// Out of bounds diag. Can't be in the table. | // Out of bounds diag. Can't be in the table. | ||||
using namespace diag; | using namespace diag; | ||||
if (DiagID >= DIAG_UPPER_LIMIT || DiagID <= DIAG_START_COMMON) | if (DiagID >= DIAG_UPPER_LIMIT || DiagID <= DIAG_START_COMMON) | ||||
return nullptr; | return nullptr; | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
#define CATEGORY(X, ENUM) { X, STR_SIZE(X, uint8_t) }, | #define CATEGORY(X, ENUM) { X, STR_SIZE(X, uint8_t) }, | ||||
#include "clang/Basic/DiagnosticGroups.inc" | #include "clang/Basic/DiagnosticGroups.inc" | ||||
#undef GET_CATEGORY_TABLE | #undef GET_CATEGORY_TABLE | ||||
{ nullptr, 0 } | { nullptr, 0 } | ||||
}; | }; | ||||
/// getNumberOfCategories - Return the number of categories | /// getNumberOfCategories - Return the number of categories | ||||
unsigned DiagnosticIDs::getNumberOfCategories() { | unsigned DiagnosticIDs::getNumberOfCategories() { | ||||
return llvm::array_lengthof(CategoryNameTable) - 1; | return std::size(CategoryNameTable) - 1; | ||||
} | } | ||||
/// getCategoryNameFromID - Given a category ID, return the name of the | /// getCategoryNameFromID - Given a category ID, return the name of the | ||||
/// category, an empty string if CategoryID is zero, or null if CategoryID is | /// category, an empty string if CategoryID is zero, or null if CategoryID is | ||||
/// invalid. | /// invalid. | ||||
StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { | StringRef DiagnosticIDs::getCategoryNameFromID(unsigned CategoryID) { | ||||
if (CategoryID >= getNumberOfCategories()) | if (CategoryID >= getNumberOfCategories()) | ||||
return StringRef(); | return StringRef(); | ||||
▲ Show 20 Lines • Show All 543 Lines • Show Last 20 Lines |