================ @@ -3458,8 +3461,34 @@ A range can also be specified by ``<n>-<m>``. For example: In this example, the diagnostic may appear only once, if at all. +.. _DiagnosticMatching: + +Matching Modes +~~~~~~~~~~~~~~ + +The default matching mode is simple string, which looks for the expected text +that appears between the first `{{` and `}}` pair of the comment. The string is +interpreted just as-is, with one exception: the sequence `\n` is converted to a +single newline character. This mode matches the emitted diagnostic when the +text appears as a substring at any position of the emitted message. + +To enable matching against desired strings that contain `}}` or `{{`, the +string-mode parser accepts opening delimiters of more than two curly braces, +like `{{{`. It then looks for a closing delimiter of equal "width" (i.e `}}}`). +For example: + +.. code-block:: c++ + + // expected-note {{{evaluates to '{{2, 3, 4}} == {0, 3, 4}'}}} + +If your expected text contains `{{{` (three braces), then it may be delimited +with `{{{{` (four braces), and so on. If your expected text contains enough ---------------- erichkeane wrote:
This last sentence is cute, but perhaps too much so. I'd suggest just removing it/stating in the previous sentence that we support 'arbitrary long' numbers of braces, and leave it at that. https://github.com/llvm/llvm-project/pull/77326 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits