[clang] [clang-format] Add .clang-format-ignore for ignoring files (PR #76327)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 00:47:18 PST 2024


steakhal wrote:

FYI commit 09308122c6c0fa9eb3d729a2b2909733cbbc2160 added [a test](https://github.com/llvm/llvm-project/commit/09308122c6c0fa9eb3d729a2b2909733cbbc2160#diff-acfc8d9d85320dbf5e181b8aebb248a91b1d321c8798bae3663b44b0c08213db) that does not pass on Windows (MSVC).

An example failure:
https://lab.llvm.org/buildbot/#/builders/123/builds/23811/steps/8/logs/stdio

```
Testing: 
FAIL: Clang :: Format/clang-format-ignore.cpp (1 of 19133)
******************** TEST 'Clang :: Format/clang-format-ignore.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
rm -rf C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir
# executed command: rm -rf 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir'
# RUN: at line 2
mkdir -p C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir/level1/level2
# executed command: mkdir -p 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir/level1/level2'
# RUN: at line 4
cd C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir
# executed command: cd 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.dir'
# RUN: at line 5
echo "*" > .clang-format-ignore
# executed command: echo '*'
# RUN: at line 6
echo "level*/*.c*" >> .clang-format-ignore
# executed command: echo 'level*/*.c*'
# RUN: at line 7
echo "*/*2/foo.*" >> .clang-format-ignore
# executed command: echo '*/*2/foo.*'
# RUN: at line 8
touch foo.cc
# executed command: touch foo.cc
# RUN: at line 9
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe -verbose .clang-format-ignore foo.cc 2> C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe' -verbose .clang-format-ignore foo.cc
# RUN: at line 10
not grep Formatting C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: not grep Formatting 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr'
# RUN: at line 12
cd level1
# executed command: cd level1
# RUN: at line 13
touch bar.cc baz.c
# executed command: touch bar.cc baz.c
# RUN: at line 14
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe -verbose bar.cc baz.c 2> C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe' -verbose bar.cc baz.c
# RUN: at line 15
not grep Formatting C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: not grep Formatting 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr'
# RUN: at line 17
cd level2
# executed command: cd level2
# RUN: at line 18
touch foo.c foo.js
# executed command: touch foo.c foo.js
# RUN: at line 19
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe -verbose foo.c foo.js 2> C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe' -verbose foo.c foo.js
# RUN: at line 20
not grep Formatting C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: not grep Formatting 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr'
# RUN: at line 22
touch .clang-format-ignore
# executed command: touch .clang-format-ignore
# RUN: at line 23
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe -verbose foo.c foo.js 2> C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\clang-format.exe' -verbose foo.c foo.js
# RUN: at line 24
grep -Fx "Formatting [1/2] foo.c" C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr
# executed command: grep -Fx 'Formatting [1/2] foo.c' 'C:\b\slave\clang-x64-windows-msvc\build\stage1\tools\clang\test\Format\Output\clang-format-ignore.cpp.tmp.stderr'
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
--
********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
********************
Failed Tests (1):
  Clang :: Format/clang-format-ignore.cpp
```

https://github.com/llvm/llvm-project/pull/76327


More information about the cfe-commits mailing list