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