[all-commits] [llvm/llvm-project] 98f7d7: [FileCheck] Improve printing variables with escape...

Mészáros Gergely via All-commits all-commits at lists.llvm.org
Fri Jun 27 13:39:30 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 98f7d756e334278e2e34177fa11e5a604d3b01ff
      https://github.com/llvm/llvm-project/commit/98f7d756e334278e2e34177fa11e5a604d3b01ff
  Author: Mészáros Gergely <gergely.meszaros at intel.com>
  Date:   2025-06-27 (Fri, 27 Jun 2025)

  Changed paths:
    M llvm/lib/FileCheck/FileCheck.cpp
    M llvm/lib/FileCheck/FileCheckImpl.h
    M llvm/test/FileCheck/var-escape.txt
    M llvm/unittests/FileCheck/FileCheckTest.cpp

  Log Message:
  -----------
  [FileCheck] Improve printing variables with escapes (#145865)

Firstly fix FileCheck printing string variables
double-escaped (first regex, then C-style).
    
This is confusing because it is not clear if the printed
value is the literal value or exactly how it is escaped, without
looking at FileCheck's source code.
    
Secondly, only escape when doing so makes it easier to read the value
(when the string contains tabs, newlines or non-printable characters).
When the variable value is escaped, make a note of it in the output too,
in order to avoid confusion.
    
The common case that is motivating this change is variables that contain
windows style paths with backslashes. These were printed as
`"C:\\\\Program Files\\\\MyApp\\\\file.txt"`.
Now prefer to print them as `"C:\Program Files\MyApp\file.txt"`.
Printing the value literally also makes it easier to search for
variables in the output, since the user can just copy-paste it.



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