xref: /llvm-project/clang/test/TableGen/wording-errors.td (revision 24a12a9c85b1ec08ff597f43e3414271d8439a97)
1// RUN: not clang-tblgen -gen-clang-diags-defs -I%S %s -o /dev/null 2>&1 | FileCheck %s
2include "DiagnosticBase.inc"
3
4// Ensure we catch a capital letter at the start of a diagnostic.
5def 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.
10def 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
13def 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
16def 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.
21def four : Error<
22  "this is fine">;
23def five : Error<
24  "%select{this|is|also}0 Fine">;
25def six : Error<
26  "%select{this|is|also|}0 fine">;
27def 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.
31def eight : Error<
32  "punctuation is bad.">;
33// CHECK-DAG: wording-errors.td:[[@LINE-2]]:5: error: Diagnostics should not end with punctuation; '.' is invalid
34def 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
37def 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
40def 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
43def 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
46def 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
49def 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.
54def fifteen : Error<
55  "question marks are intentionally okay?">;
56