clang 22.0.0git
DiagnosticIDs.cpp File Reference
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/AllDiagnostics.h"
#include "clang/Basic/DiagnosticCategories.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringTable.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <map>
#include <optional>
#include "clang/Basic/AllDiagnosticKinds.inc"
#include "clang/Basic/DiagnosticCommonKinds.inc"
#include "clang/Basic/DiagnosticDriverKinds.inc"
#include "clang/Basic/DiagnosticFrontendKinds.inc"
#include "clang/Basic/DiagnosticSerializationKinds.inc"
#include "clang/Basic/DiagnosticLexKinds.inc"
#include "clang/Basic/DiagnosticParseKinds.inc"
#include "clang/Basic/DiagnosticASTKinds.inc"
#include "clang/Basic/DiagnosticCommentKinds.inc"
#include "clang/Basic/DiagnosticCrossTUKinds.inc"
#include "clang/Basic/DiagnosticSemaKinds.inc"
#include "clang/Basic/DiagnosticAnalysisKinds.inc"
#include "clang/Basic/DiagnosticRefactoringKinds.inc"
#include "clang/Basic/DiagnosticInstallAPIKinds.inc"
#include "clang/Basic/DiagnosticTrapKinds.inc"
#include "clang/Basic/DiagnosticGroups.inc"
#include "clang/Basic/DiagnosticAllCompatIDs.inc"

Go to the source code of this file.

Classes

class  clang::diag::CustomDiagInfo

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::diag

Macros

#define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY)
#define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY)
#define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY)
#define STRINGIFY_NAME(NAME)
#define VALIDATE_DIAG_SIZE(NAME)
#define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY)
#define CATEGORY(NAME, PREV)
#define GET_CATEGORY_TABLE
#define CATEGORY(X, ENUM)
#define GET_DIAG_ARRAYS
#define DIAG_ENTRY(GroupName, FlagNameOffset, Members, SubGroups, Docs)
#define DIAG_COMPAT_IDS_BEGIN()
#define DIAG_COMPAT_IDS_END()
#define DIAG_COMPAT_ID(Value, Name, Std, Diag, DiagPre)

Typedefs

using clang::diag::CustomDiagDesc = DiagnosticIDs::CustomDiagDesc

Functions

static const StaticDiagInfoRec * GetDiagInfo (unsigned DiagID)
 GetDiagInfo - Return the StaticDiagInfoRec entry for the specified DiagID, or null if the ID is invalid.
static DiagnosticIDs::Level toLevel (diag::Severity SV)
static bool getDiagnosticsInGroup (diag::Flavor Flavor, const WarningOption *Group, SmallVectorImpl< diag::kind > &Diags, diag::CustomDiagInfo *CustomDiagInfo)
 Return true if any diagnostics were found in this group, even if they were filtered out due to having the wrong flavor.
template<class Func>
static void forEachSubGroupImpl (const WarningOption *Group, Func func)
template<class Func>
static void forEachSubGroup (diag::Group Group, Func func)

Variables

static const unsigned StaticDiagInfoSize = std::size(StaticDiagInfo)
static const StaticDiagCategoryRec CategoryNameTable []
static const WarningOption OptionTable []

Macro Definition Documentation

◆ CATEGORY [1/2]

#define CATEGORY ( NAME,
PREV )
Value:
if (DiagID > DIAG_START_##NAME) { \
Offset += NUM_BUILTIN_##PREV##_DIAGNOSTICS - DIAG_START_##PREV - 1; \
ID -= DIAG_START_##NAME - DIAG_START_##PREV; \
}

Referenced by GetDiagInfo().

◆ CATEGORY [2/2]

#define CATEGORY ( X,
ENUM )
Value:
{ X, STR_SIZE(X, uint8_t) },
#define STR_SIZE(str, fieldTy)
#define X(type, name)
Definition Value.h:97

◆ DIAG [1/4]

#define DIAG ( ENUM,
CLASS,
DEFAULT_SEVERITY,
DESC,
GROUP,
SFINAE,
NOWERROR,
SHOWINSYSHEADER,
SHOWINSYSMACRO,
DEFERRABLE,
CATEGORY )
Value:
char ENUM##_desc[sizeof(DESC)];
#define ENUM(NAME, LIT)

Definition at line 39 of file DiagnosticIDs.cpp.

Referenced by CheckProtocolMethodDefs(), and clang::SemaObjC::DiagnoseUnusedBackingIvarInAccessor().

◆ DIAG [2/4]

#define DIAG ( ENUM,
CLASS,
DEFAULT_SEVERITY,
DESC,
GROUP,
SFINAE,
NOWERROR,
SHOWINSYSHEADER,
SHOWINSYSMACRO,
DEFERRABLE,
CATEGORY )
Value:
DESC,

Definition at line 39 of file DiagnosticIDs.cpp.

◆ DIAG [3/4]

#define DIAG ( ENUM,
CLASS,
DEFAULT_SEVERITY,
DESC,
GROUP,
SFINAE,
NOWERROR,
SHOWINSYSHEADER,
SHOWINSYSMACRO,
DEFERRABLE,
CATEGORY )
Value:
offsetof(StaticDiagInfoDescriptionStringTable, ENUM##_desc),
#define offsetof(t, d)

Definition at line 39 of file DiagnosticIDs.cpp.

◆ DIAG [4/4]

#define DIAG ( ENUM,
CLASS,
DEFAULT_SEVERITY,
DESC,
GROUP,
SFINAE,
NOWERROR,
SHOWINSYSHEADER,
SHOWINSYSMACRO,
DEFERRABLE,
CATEGORY )
Value:
{ \
diag::ENUM, \
DEFAULT_SEVERITY, \
CLASS, \
DiagnosticIDs::SFINAE, \
NOWERROR, \
SHOWINSYSHEADER, \
SHOWINSYSMACRO, \
GROUP, \
DEFERRABLE, \
STR_SIZE(DESC, uint16_t)},
#define CATEGORY(X, ENUM)

Definition at line 39 of file DiagnosticIDs.cpp.

◆ DIAG_COMPAT_ID

#define DIAG_COMPAT_ID ( Value,
Name,
Std,
Diag,
DiagPre )
Value:
{Std == 98 ? 1998 : 2000 + Std, diag::Diag, diag::DiagPre},

◆ DIAG_COMPAT_IDS_BEGIN

#define DIAG_COMPAT_IDS_BEGIN ( )

◆ DIAG_COMPAT_IDS_END

#define DIAG_COMPAT_IDS_END ( )

◆ DIAG_ENTRY

#define DIAG_ENTRY ( GroupName,
FlagNameOffset,
Members,
SubGroups,
Docs )
Value:
{FlagNameOffset, Members, SubGroups, Docs},

◆ GET_CATEGORY_TABLE

#define GET_CATEGORY_TABLE

◆ GET_DIAG_ARRAYS

#define GET_DIAG_ARRAYS

Definition at line 591 of file DiagnosticIDs.cpp.

◆ STRINGIFY_NAME

#define STRINGIFY_NAME ( NAME)
Value:
#NAME

Definition at line 120 of file DiagnosticIDs.cpp.

◆ VALIDATE_DIAG_SIZE

#define VALIDATE_DIAG_SIZE ( NAME)
Value:
static_assert( \
static_cast<unsigned>(diag::NUM_BUILTIN_##NAME##_DIAGNOSTICS) < \
static_cast<unsigned>(diag::DIAG_START_##NAME) + \
static_cast<unsigned>(diag::DIAG_SIZE_##NAME), \
STRINGIFY_NAME( \
DIAG_SIZE_##NAME) " is insufficient to contain all " \
"diagnostics, it may need to be made larger in " \
"DiagnosticIDs.h.");

Definition at line 121 of file DiagnosticIDs.cpp.

Function Documentation

◆ forEachSubGroup()

template<class Func>
void forEachSubGroup ( diag::Group Group,
Func func )
static

◆ forEachSubGroupImpl()

template<class Func>
void forEachSubGroupImpl ( const WarningOption * Group,
Func func )
static

Definition at line 716 of file DiagnosticIDs.cpp.

References forEachSubGroupImpl(), clang::Func, and OptionTable.

Referenced by forEachSubGroup(), and forEachSubGroupImpl().

◆ GetDiagInfo()

const StaticDiagInfoRec * GetDiagInfo ( unsigned DiagID)
static

◆ getDiagnosticsInGroup()

bool getDiagnosticsInGroup ( diag::Flavor Flavor,
const WarningOption * Group,
SmallVectorImpl< diag::kind > & Diags,
diag::CustomDiagInfo * CustomDiagInfo )
static

Return true if any diagnostics were found in this group, even if they were filtered out due to having the wrong flavor.

Definition at line 667 of file DiagnosticIDs.cpp.

References GetDiagInfo(), getDiagnosticsInGroup(), clang::diag::CustomDiagInfo::getDiagsInGroup(), clang::Member, clang::NotFound, OptionTable, and clang::diag::Remark.

Referenced by getDiagnosticsInGroup().

◆ toLevel()

Variable Documentation

◆ CategoryNameTable

const StaticDiagCategoryRec CategoryNameTable[]
static
Initial value:
= {
#define GET_CATEGORY_TABLE
#define CATEGORY(X, ENUM)
{ nullptr, 0 }
}

Definition at line 340 of file DiagnosticIDs.cpp.

Referenced by clang::DiagnosticIDs::getCategoryNameFromID(), and clang::DiagnosticIDs::getNumberOfCategories().

◆ OptionTable

◆ StaticDiagInfoSize

const unsigned StaticDiagInfoSize = std::size(StaticDiagInfo)
static

Definition at line 183 of file DiagnosticIDs.cpp.

Referenced by clang::DiagnosticIDs::getAllDiagnostics(), and GetDiagInfo().