[all-commits] [llvm/llvm-project] baa8c2: [Clang] Wide delimiters ('{{{') for expect strings...

sethp via All-commits all-commits at lists.llvm.org
Tue Jan 9 12:46:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: baa8c2abcd8da31549996458c9df4871454b0673
      https://github.com/llvm/llvm-project/commit/baa8c2abcd8da31549996458c9df4871454b0673
  Author: sethp <seth.pellegrino at gmail.com>
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
    M clang/docs/InternalsManual.rst
    M clang/include/clang/Basic/DiagnosticFrontendKinds.td
    M clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
    M clang/test/Frontend/verify.c

  Log Message:
  -----------
  [Clang] Wide delimiters ('{{{') for expect strings (#77326)

Prior to this commit, it was impossible to use the simple string
matching directives to look for any content that contains unbalanced
`{{` `}}` pairs, such as:

```
// expected-note {{my_struct{{1}, 2}}}
```

Which would parse like so:

```
             "nested" brace v
// expected-note {{my_struct{{1}, 2}}}
          closes the nested brace  ^ |
                            trailing }
```

And the frontend would complain 'cannot find end ('}}') of expected'.

At this snapshot, VerifyDiagnosticConsumer's parser now counts the
opening braces and looks for a matching length of closing sigils,
allowing the above to be written as:

```
// expected-note {{{my_struct{{1}, 2}}}}
   opening brace |-|                 |-|
  closing brace is '}}}', found here ^
```

This came about as a result of this discussion:
https://github.com/llvm/llvm-project/pull/74852#discussion_r1443117644

cc @erichkeane




More information about the All-commits mailing list