1 | // RUN: clang-tblgen -gen-diag-docs -I%S %s -o - 2>&1 | \ |
2 | // RUN: FileCheck --strict-whitespace %s |
3 | include "DiagnosticBase.inc" |
4 | |
5 | def MyGroup : DiagGroup<"MyGroupName">; |
6 | |
7 | def MyKinds : TextSubstitution<"%select{food|forests}0">; |
8 | def MyGoodBad : TextSubstitution<"%select{good|bad}0">; |
9 | def MySubNested : TextSubstitution<"%sub{MyGoodBad}1 %sub{MyKinds}2 are %sub{MyGoodBad}1 according to %0">; |
10 | |
11 | // CHECK: -WMyGroupName |
12 | // CHECK: **Diagnostic text:** |
13 | |
14 | let Group = MyGroup in { |
15 | |
16 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`this is my diff text`| |
17 | // CHECK-NEXT: +-----------------------------------------------------------+ |
18 | def CheckDiff : Warning<"%diff{$ is not $|this is my diff text}0,1">; |
19 | |
20 | |
21 | // CHECK: |:warning:`warning:` |nbsp| :placeholder:`A` |nbsp| :diagtext:`is my modifier test` |nbsp| :placeholder:`B`| |
22 | // CHECK-NEXT: +----------------------------------------------------------------------------------------------------------+ |
23 | def CheckModifier : Warning<"%0 is my modifier test %1">; |
24 | |
25 | |
26 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`This is the` |nbsp| :placeholder:`A` |nbsp| :diagtext:`test I've written`| |
27 | // CHECK-NEXT: +---------------------------------------------------------------------------------------------------------------+ |
28 | def CheckOrdinal : Warning<"This is the %ordinal0 test I've written">; |
29 | |
30 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`I wrote` |nbsp| |+----------------+| |nbsp| :diagtext:`tests`| |
31 | // CHECK-NEXT: | ||:diagtext:`no` || | |
32 | // CHECK-NEXT: | |+----------------+| | |
33 | // CHECK-NEXT: | ||:diagtext:`one` || | |
34 | // CHECK-NEXT: | |+----------------+| | |
35 | // CHECK-NEXT: | ||:placeholder:`A`|| | |
36 | // CHECK-NEXT: | |+----------------+| | |
37 | // CHECK-NEXT: +------------------------------------------------------+------------------+-------------------------+ |
38 | def CheckPlural : Warning<"I wrote %plural{0:no|1:one|:%0}0 tests">; |
39 | |
40 | |
41 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`bad type` |nbsp| :placeholder:`A`| |
42 | // CHECK-NEXT: +-----------------------------------------------------------------------+ |
43 | def CheckQ : Warning<"bad type %q0">; |
44 | |
45 | |
46 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`My test`|+-------------+| |nbsp| :diagtext:`are the best!`| |
47 | // CHECK-NEXT: | || || | |
48 | // CHECK-NEXT: | |+-------------+| | |
49 | // CHECK-NEXT: | ||:diagtext:`s`|| | |
50 | // CHECK-NEXT: | |+-------------+| | |
51 | // CHECK-NEXT: +----------------------------------------------+---------------+---------------------------------+ |
52 | def CheckS : Warning<"My test%s0 are the best!">; |
53 | |
54 | |
55 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`this is my select test:` |nbsp| |+---------------+| |
56 | // CHECK-NEXT: | ||:diagtext:`one`|| |
57 | // CHECK-NEXT: | |+---------------+| |
58 | // CHECK-NEXT: | ||:diagtext:`two`|| |
59 | // CHECK-NEXT: | |+---------------+| |
60 | // CHECK-NEXT: +----------------------------------------------------------------------+-----------------+ |
61 | def CheckSelect : Warning<"this is my select test: %select{one|two}0 and it is %select{good|bad}1">; |
62 | |
63 | |
64 | // CHECK: +-------------------------------------------------------+------------------+--------+---------------------+-------------------------------+------------------+--------------------------------------------------------+ |
65 | // CHECK-NEXT: |:warning:`warning:` |nbsp| :diagtext:`They say` |nbsp| |+----------------+| |nbsp| |+-------------------+| |nbsp| :diagtext:`are` |nbsp| |+----------------+| |nbsp| :diagtext:`according to` |nbsp| :placeholder:`D`| |
66 | // CHECK-NEXT: | ||:diagtext:`good`|| ||:diagtext:`food` || ||:diagtext:`good`|| | |
67 | // CHECK-NEXT: | |+----------------+| |+-------------------+| |+----------------+| | |
68 | // CHECK-NEXT: | ||:diagtext:`bad` || ||:diagtext:`forests`|| ||:diagtext:`bad` || | |
69 | // CHECK-NEXT: | |+----------------+| |+-------------------+| |+----------------+| | |
70 | // CHECK-NEXT: +-------------------------------------------------------+------------------+--------+---------------------+-------------------------------+------------------+--------------------------------------------------------+ |
71 | def CheckSubstitution : Warning<"They say %sub{MySubNested}3,1,0">; |
72 | |
73 | |
74 | // CHECK: |:warning:`warning:` |nbsp| :diagtext:`this is my warning text`| |
75 | // CHECK-NEXT: +--------------------------------------------------------------+ |
76 | def CheckText : Warning<"this is my warning text">; |
77 | |
78 | } |
79 | |