[all-commits] [llvm/llvm-project] 0f1f45: [FileCheck] Call out var captures on unmatched pat...

Joel E. Denny via All-commits all-commits at lists.llvm.org
Fri Jul 3 17:09:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f1f456263b5889935514ecf81440d0909d06dc7
      https://github.com/llvm/llvm-project/commit/0f1f456263b5889935514ecf81440d0909d06dc7
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2026-07-03 (Fri, 03 Jul 2026)

  Changed paths:
    M llvm/lib/FileCheck/FileCheck.cpp
    M llvm/lib/FileCheck/FileCheckImpl.h
    M llvm/test/FileCheck/match-time-error-propagation/matched-excluded-pattern.txt
    M llvm/test/FileCheck/match-time-error-propagation/matched-expected-pattern.txt
    A llvm/test/FileCheck/unmatched-substs-captures.txt

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list