Files
Joel E. Denny 0f1f456263 [FileCheck] Call out var captures on unmatched patterns (#206303)
This patch is motivated by an #llvm IRC chat in 2019 with @AaronBallman,
where he pointed out an example similar to following:

```
$ cat input
[[clang::optnone]] void foo() {

$ cat check
CHECK: [[clang::optnone]] void foo() {

$ FileCheck check < input |& tail -7
Input was:
<<<<<<
           1: [[clang::optnone]] void foo() {
check:1'0    {                                } search range (exclusive bounds)
check:1'1                                       error: no match found
check:1'2            ?                          possible intended match
>>>>>>
```

It is very easy to miss why that fails. This patch adds one more note
that hopefully clears up the confusion:

```
$ FileCheck check < input |& tail -8
Input was:
<<<<<<
           1: [[clang::optnone]] void foo() {
check:1'0    {                                } search range (exclusive bounds)
check:1'1                                       error: no match found
check:1'2                                       pattern attempts to capture variables: "clang"
check:1'3            ?                          possible intended match
>>>>>>
```

That is, where matching patterns print successful variable captures,
this patch makes unmatching patterns print attempted variable captures.
2026-07-03 20:08:59 -04:00
..