[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:37:38 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:
How do you feel about things like: `%enum_select<?>{%^no^{V1}}0` where there are invalid identifier characters being used? No idea how bad the diagnostic behavior would be falling out of just assuming nobody does that.
https://github.com/llvm/llvm-project/pull/122505
More information about the cfe-commits
mailing list