| 1 |
// RUN: not clang-tblgen -gen-clang-diags-defs -I%S %s -o /dev/null 2>&1 | FileCheck %s |
| 2 |
include "DiagnosticBase.inc" |
| 3 |
|
| 4 |
// Ensure we catch a capital letter at the start of a diagnostic. |
| 5 |
def zero : Error< |
| 6 |
"This is bad">; |
| 7 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not start with a capital letter; 'This' is invalid |
| 8 |
|
| 9 |
// Test that we also correctly handle selections. |
| 10 |
def one : Error< |
| 11 |
"%select{|or}0 That">; |
| 12 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not start with a capital letter; 'That' is invalid |
| 13 |
def two : Error< |
| 14 |
"%select{as does|}0 This">; |
| 15 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not start with a capital letter; 'This' is invalid |
| 16 |
def three : Error< |
| 17 |
"%select{and||of course}0 Whatever">; |
| 18 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not start with a capital letter; 'Whatever' is invalid |
| 19 |
|
| 20 |
// Test that we accept the following cases. |
| 21 |
def four : Error< |
| 22 |
"this is fine">; |
| 23 |
def five : Error< |
| 24 |
"%select{this|is|also}0 Fine">; |
| 25 |
def six : Error< |
| 26 |
"%select{this|is|also|}0 fine">; |
| 27 |
def seven : Error< |
| 28 |
"%select{ARC|C|C23|C++14|OpenMP}0 are also fine">; |
| 29 |
|
| 30 |
// Next, test that we catch punctuation at the end of the diagnostic. |
| 31 |
def eight : Error< |
| 32 |
"punctuation is bad.">; |
| 33 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 34 |
def nine : Error< |
| 35 |
"it's really bad!">; |
| 36 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '!' is invalid |
| 37 |
def ten : Error< |
| 38 |
"we also catch %select{punctuation.|in select}0">; |
| 39 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 40 |
def eleven : Error< |
| 41 |
"and %select{|here.}0">; |
| 42 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 43 |
def twelve : Error< |
| 44 |
"and %select{here.|}0">; |
| 45 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 46 |
def thirteen : Error< |
| 47 |
"and even %select{|here.|}0">; |
| 48 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 49 |
def fourteen : Error< |
| 50 |
"and %select{here}0.">; |
| 51 |
// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid |
| 52 |
|
| 53 |
// Test that we accept the following cases. |
| 54 |
def fifteen : Error< |
| 55 |
"question marks are intentionally okay?">; |