| 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| |+--------------------------------------------------------------------+| |
| 17 |
// CHECK-NEXT: | ||+------------------------------------------------------------------+|| |
| 18 |
// CHECK-NEXT: | |||:placeholder:`A` |nbsp| :diagtext:`is not` |nbsp| :placeholder:`B`||| |
| 19 |
// CHECK-NEXT: | ||+------------------------------------------------------------------+|| |
| 20 |
// CHECK-NEXT: | |+--------------------------------------------------------------------+| |
| 21 |
// CHECK-NEXT: | ||:diagtext:`this is my diff text` || |
| 22 |
// CHECK-NEXT: | |+--------------------------------------------------------------------+| |
| 23 |
// CHECK-NEXT: +---------------------------+----------------------------------------------------------------------+ |
| 24 |
def CheckDiff : Warning<"%diff{$ is not $|this is my diff text}0,1">; |
| 25 |
|
| 26 |
|
| 27 |
// CHECK: |:warning:`warning:` |nbsp| :placeholder:`A` |nbsp| :diagtext:`is my modifier test` |nbsp| :placeholder:`B`| |
| 28 |
// CHECK-NEXT: +----------------------------------------------------------------------------------------------------------+ |
| 29 |
def CheckModifier : Warning<"%0 is my modifier test %1">; |
| 30 |
|
| 31 |
|
| 32 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`This is the` |nbsp| :placeholder:`A` |nbsp| :diagtext:`test I've written`| |
| 33 |
// CHECK-NEXT: +---------------------------------------------------------------------------------------------------------------+ |
| 34 |
def CheckOrdinal : Warning<"This is the %ordinal0 test I've written">; |
| 35 |
|
| 36 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`I wrote` |nbsp| |+----------------+| |nbsp| :diagtext:`tests`| |
| 37 |
// CHECK-NEXT: | ||:diagtext:`no` || | |
| 38 |
// CHECK-NEXT: | |+----------------+| | |
| 39 |
// CHECK-NEXT: | ||:diagtext:`one` || | |
| 40 |
// CHECK-NEXT: | |+----------------+| | |
| 41 |
// CHECK-NEXT: | ||:placeholder:`A`|| | |
| 42 |
// CHECK-NEXT: | |+----------------+| | |
| 43 |
// CHECK-NEXT: +------------------------------------------------------+------------------+-------------------------+ |
| 44 |
def CheckPlural : Warning<"I wrote %plural{0:no|1:one|:%0}0 tests">; |
| 45 |
|
| 46 |
|
| 47 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`bad type` |nbsp| :placeholder:`A`| |
| 48 |
// CHECK-NEXT: +-----------------------------------------------------------------------+ |
| 49 |
def CheckQ : Warning<"bad type %q0">; |
| 50 |
|
| 51 |
|
| 52 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`My test`|+-------------+| |nbsp| :diagtext:`are the best!`| |
| 53 |
// CHECK-NEXT: | || || | |
| 54 |
// CHECK-NEXT: | |+-------------+| | |
| 55 |
// CHECK-NEXT: | ||:diagtext:`s`|| | |
| 56 |
// CHECK-NEXT: | |+-------------+| | |
| 57 |
// CHECK-NEXT: +----------------------------------------------+---------------+---------------------------------+ |
| 58 |
def CheckS : Warning<"My test%s0 are the best!">; |
| 59 |
|
| 60 |
|
| 61 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`this is my select test:` |nbsp| |+---------------+| |
| 62 |
// CHECK-NEXT: | ||:diagtext:`one`|| |
| 63 |
// CHECK-NEXT: | |+---------------+| |
| 64 |
// CHECK-NEXT: | ||:diagtext:`two`|| |
| 65 |
// CHECK-NEXT: | |+---------------+| |
| 66 |
// CHECK-NEXT: +----------------------------------------------------------------------+-----------------+ |
| 67 |
def CheckSelect : Warning<"this is my select test: %select{one|two}0 and it is %select{good|bad}1">; |
| 68 |
|
| 69 |
|
| 70 |
// CHECK: +-------------------------------------------------------+------------------+--------+---------------------+-------------------------------+------------------+--------------------------------------------------------+ |
| 71 |
// CHECK-NEXT: |:warning:`warning:` |nbsp| :diagtext:`They say` |nbsp| |+----------------+| |nbsp| |+-------------------+| |nbsp| :diagtext:`are` |nbsp| |+----------------+| |nbsp| :diagtext:`according to` |nbsp| :placeholder:`D`| |
| 72 |
// CHECK-NEXT: | ||:diagtext:`good`|| ||:diagtext:`food` || ||:diagtext:`good`|| | |
| 73 |
// CHECK-NEXT: | |+----------------+| |+-------------------+| |+----------------+| | |
| 74 |
// CHECK-NEXT: | ||:diagtext:`bad` || ||:diagtext:`forests`|| ||:diagtext:`bad` || | |
| 75 |
// CHECK-NEXT: | |+----------------+| |+-------------------+| |+----------------+| | |
| 76 |
// CHECK-NEXT: +-------------------------------------------------------+------------------+--------+---------------------+-------------------------------+------------------+--------------------------------------------------------+ |
| 77 |
def CheckSubstitution : Warning<"They say %sub{MySubNested}3,1,0">; |
| 78 |
|
| 79 |
|
| 80 |
// CHECK: |:warning:`warning:` |nbsp| :diagtext:`this is my warning text`| |
| 81 |
// CHECK-NEXT: +--------------------------------------------------------------+ |
| 82 |
def CheckText : Warning<"this is my warning text">; |
| 83 |
|
| 84 |
} |