[clang] [diagtool] Make the BuiltinDiagnosticsByID table sorted (PR #120321)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 3 02:16:46 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
----------------
kadircet wrote:
also it's unclear where the "ground truth" for this order is coming from. AFAICT, order is defined by https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/DiagnosticIDs.h#L49-L65
and enforced by very subtle interactions between tablegen and how particular headers include these.
since this order needs to be preserved in multiple places, can you put together a wrapper header, which includes individual diagnostic kinds in the specific order and explain the relationship between these pieces? (I'd rather have a solution that puts all of this logic into tablegen instead, generating enums with a particular order once, but I can see that's a much bigger change that you might not want to sign up).
https://github.com/llvm/llvm-project/pull/120321
More information about the cfe-commits
mailing list