Skip to content
Commit 86278114 authored by Ji, Jinsong's avatar Ji, Jinsong
Browse files

[clang-format] Support new file formatting with vim

The vim Formatonsave integration is not working if we create a new file directly using vim.
eg: vi -V9t.log t.cpp

It will not able to format the buffer.

> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "...clang/tools/clang-format/clang-format.py", line 156, in <module>
>     main()
>   File "...clang/tools/clang-format/clang-format.py", line 80, in main
>     with open(vim.current.buffer.name, 'r') as f:
> FileNotFoundError: [Errno 2] No such file or directory: '...t.cpp'

This patch check the file before we try to open it.

Reviewed By: owenpan

Differential Revision: https://reviews.llvm.org/D138234
parent 4548fca7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment