[clang] [Clang][Diagnostics] Update select uses in DiagnosticXKinds.td to use enum_select (PR #130868)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 19 06:13:49 PDT 2025


================
@@ -11,8 +11,9 @@ let Component = "AST" in {
 // Constant expression diagnostics. These (and their users) belong in Sema.
 def note_expr_divide_by_zero : Note<"division by zero">;
 def note_constexpr_invalid_cast : Note<
-  "%select{reinterpret_cast|dynamic_cast|%select{this conversion|cast that"
-  " performs the conversions of a reinterpret_cast}1|cast from %1}0"
+  "%enum_select<CastKind>{%Reinterpret{reinterpret_cast}|%Dynamic{dynamic_cast}|"
----------------
erichkeane wrote:

```suggestion
  "%enum_select<CastKind>{%Reinterpret{reinterpret_cast}|%Dynamic{dynamic_cast}|"
```
The name `CastKind` likely should be a little less generic, simply because we can't really duplicate names.  Perhaps: `ConstexprInvalidCastKind`? 

https://github.com/llvm/llvm-project/pull/130868


More information about the cfe-commits mailing list