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