xref: /llvm-project/clang/test/TableGen/select-enum-errors.td (revision bf17016a92bc8a23d2cdd2b51355dd4eb5019c68)
1*bf17016aSErich Keane// RUN: not clang-tblgen --gen-clang-diags-enums -DERROR1 -I%S %s 2>&1 | FileCheck %s --check-prefixes=CHECK,C1
2*bf17016aSErich Keane// RUN: not clang-tblgen --gen-clang-diags-enums -DERROR2 -I%S %s 2>&1 | FileCheck %s --check-prefixes=CHECK,C2
3*bf17016aSErich Keane// RUN: not clang-tblgen --gen-clang-diags-enums -DERROR3 -I%S %s 2>&1 | FileCheck %s --check-prefixes=CHECK,C3
4*bf17016aSErich Keane// RUN: not clang-tblgen --gen-clang-diags-enums -DERROR4 -I%S %s 2>&1 | FileCheck %s --check-prefixes=CHECK,C4
5*bf17016aSErich Keaneinclude "DiagnosticBase.inc"
6*bf17016aSErich Keane
7*bf17016aSErich Keane// No real reason to diagnose these, the namespace generated as the
8*bf17016aSErich Keane// 'enumeration' name will never conflict with the enumerator.
9*bf17016aSErich Keanedef EnumerationEnumeratorDupe : Error<"%enum_select<Matchy>{%Matchy{haha}}0">;
10*bf17016aSErich Keane
11*bf17016aSErich Keane// Enumerator values aren't required, though this does seem kind of silly/not
12*bf17016aSErich Keane// particularly useful?
13*bf17016aSErich Keanedef NoEnumerators : Error<"%enum_select<Name>{foo|bar|baz}0">;
14*bf17016aSErich Keane
15*bf17016aSErich Keanedef DupeNames1 : Error<"%enum_select<DupeName>{}0">;
16*bf17016aSErich Keanedef DupeNames2 : Error<"%enum_select<DupeName>{}0">;
17*bf17016aSErich Keane// CHECK: error: Duplicate enumeration name 'DupeName'
18*bf17016aSErich Keane// CHECK-NEXT: def DupeNames2
19*bf17016aSErich Keane// CHECK: note: Previous diagnostic is here
20*bf17016aSErich Keane// CHECK-NEXT: def DupeNames1
21*bf17016aSErich Keane
22*bf17016aSErich Keanedef DupeValue : Error<"%enum_select<DupeValue>{%DName{V1}|%DName{V2}}0">;
23*bf17016aSErich Keane// CHECK: error: Duplicate enumerator name 'DName'
24*bf17016aSErich Keane
25*bf17016aSErich Keane#ifdef ERROR1
26*bf17016aSErich Keanedef EnumValNotExpected : Error<"%enum_select{V1|%Val2{V2}}0">;
27*bf17016aSErich Keane// C1: expected '<' after enum_select
28*bf17016aSErich Keane#endif
29*bf17016aSErich Keane
30*bf17016aSErich Keane#ifdef ERROR2
31*bf17016aSErich Keanedef SelectWithArrow : Error<"%select<Something>{V1|%Val2{V2}}0">;
32*bf17016aSErich Keane// C2: modifier '<' syntax not valid with %select
33*bf17016aSErich Keane#endif
34*bf17016aSErich Keane
35*bf17016aSErich Keane#ifdef ERROR3
36*bf17016aSErich Keane// Missing closing > after the name of the enumeration
37*bf17016aSErich Keanedef MissingClosing : Error<"%enum_select<MissingClosingName{}0">;
38*bf17016aSErich Keane// C3: expected '>' while parsing %enum_select
39*bf17016aSErich Keane#endif
40*bf17016aSErich Keane
41*bf17016aSErich Keane#ifdef ERROR4
42*bf17016aSErich Keane// Missing { after the name of an enumerator
43*bf17016aSErich Keanedef MissingTextAfterEnumerator: Error<"%enum_select<Name>{%OtherName|foo}0">;
44*bf17016aSErich Keane// C4: expected '{' while parsing %enum_select
45*bf17016aSErich Keane#endif
46