[clang] Add 'enum_select' diagnostic selection to clang. (PR #122505)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 14 11:42:46 PST 2025


================
@@ -0,0 +1,16 @@
+// RUN: clang-tblgen --gen-clang-diags-enums -I%S %s 2>&1 | FileCheck %s
+include "DiagnosticBase.inc"
+
+def DupeNames1 : Error<"%enum_select<DupeName>{}0">;
+def DupeNames2 : Error<"%enum_select<DupeName>{}0">;
+// CHECK: error: Duplicate enumeration name 'DupeName'
+// CHECK-NEXT: def DupeNames2
+// CHECK: note: Previous diagnostic is here
+// CHECK-NEXT: def DupeNames1
+
+def DupeValue : Error<"%enum_select<DupeValue>{%Name{V1}|%Name{V2}}0">;
+// CHECK: error: Duplicate enumerator name 'Name'
+
+def EnumValNotExpected : Error<"%enum_select{V1|%Val2{V2}}0">;
----------------
AaronBallman wrote:

Eh, let's not bother; I don't imagine this is a problem we'll hit all that often and it should still produce diagnostics somewhere, so if we do, we'll know.

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


More information about the cfe-commits mailing list