[clang] [diagtool] Make the BuiltinDiagnosticsByID table sorted (PR #120321)
Karl-Johan Karlsson via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 07:07:26 PST 2025
================
@@ -23,28 +23,29 @@ llvm::ArrayRef<DiagnosticRecord> diagtool::getBuiltinDiagnosticsByName() {
return llvm::ArrayRef(BuiltinDiagnosticsByName);
}
-
// FIXME: Is it worth having two tables, especially when this one can get
// out of sync easily?
+// clang-format off
static const DiagnosticRecord BuiltinDiagnosticsByID[] = {
#define DIAG(ENUM, CLASS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \
SHOWINSYSHEADER, SHOWINSYSMACRO, DEFER, CATEGORY) \
{#ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t)},
#include "clang/Basic/DiagnosticCommonKinds.inc"
-#include "clang/Basic/DiagnosticCrossTUKinds.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"
----------------
karka228 wrote:
> This seems brittle - Maybe we should call `std::sort` somewhere instead?
I agree that it is a bit brittle, but it is hard to find a good place where to insert a `std::sort`. As @kadircet wrote it is probably better in the future to solve this in a better way in tablegen.
https://github.com/llvm/llvm-project/pull/120321
More information about the cfe-commits
mailing list