[cfe-dev] Doing away with DiagnosticIndexName.inc

Javier Múgica javier_3 at runbox.com
Sun Jun 21 05:28:24 PDT 2015


I posted a message about splitting the 


A search through the code only found one instance of DiagnosticIndexName.inc and the corresponding DIAG_NAME_INDEX. They can be found in DiagnosticNames.cpp

#define DIAG_NAME_INDEX(ENUM) { #ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t) },
#include "clang/Basic/DiagnosticIndexName.inc"
#undef DIAG_NAME_INDEX

Having stuff dupplicate is always a source of errors and makes it more difficult to newcommers to submit patches. Couldn't this code use DiagnosticSemaKinds and just discard the other arguments? This is actually used in several places:

#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\
             SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,

While I am writing this message I noticed one of those sevveral place is the same file DiagnosticNames.cpp, just some lines below the use of DIAG_NAME_INDEX, with a Fixme not for the reason I am sending this message to the list: 

// FIXME: Is it worth having two tables, especially when this one can get
// out of sync easily?
static const DiagnosticRecord BuiltinDiagnosticsByID[] = {
#define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP,               \
             SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY)            \
  { #ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t) },





More information about the cfe-dev mailing list