brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.6 KiB · 2dd1a6b Raw
85 lines · plain
1// RUN: clang-tblgen -gen-diag-docs -I%S %s -o - 2>&1 | \2// RUN:    FileCheck --strict-whitespace %s3include "DiagnosticBase.inc"4 5def MyGroup : DiagGroup<"MyGroupName">;6 7def MyKinds : TextSubstitution<"%select{food|forests}0">;8def MyGoodBad : TextSubstitution<"%select{good|bad}0">;9def MySubNested : TextSubstitution<"%sub{MyGoodBad}1 %sub{MyKinds}2 are %sub{MyGoodBad}1 according to %0">;10 11// CHECK: -WMyGroupName12// CHECK: **Diagnostic text:**13 14let 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: +---------------------------+----------------------------------------------------------------------+24def 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: +----------------------------------------------------------------------------------------------------------+29def 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: +---------------------------------------------------------------------------------------------------------------+34def 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: +------------------------------------------------------+------------------+-------------------------+44def 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: +-----------------------------------------------------------------------+49def 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: +----------------------------------------------+---------------+---------------------------------+58def 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: +----------------------------------------------------------------------+-----------------+67def 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: +-------------------------------------------------------+------------------+--------+---------------------+-------------------------------+------------------+--------------------------------------------------------+77def 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: +--------------------------------------------------------------+82def CheckText : Warning<"this is my warning text">;83 84}85