diff options
author | Nico Weber <nicolasweber@gmx.de> | 2013-10-25 20:06:20 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2013-10-25 20:06:20 +0000 |
commit | 73e9431d545cdbb8b61d1c9e7930832162e6011f (patch) | |
tree | 3ab73ff9799dd0d814ced3a813af71641c4eab69 /tools/clang-format | |
parent | 5c47b38e4f23e795c7996c236af5d076e41eac01 (diff) | |
download | clang-73e9431d545cdbb8b61d1c9e7930832162e6011f.tar.gz clang-73e9431d545cdbb8b61d1c9e7930832162e6011f.tar.bz2 clang-73e9431d545cdbb8b61d1c9e7930832162e6011f.tar.xz |
clang-format.py: Make formatting unnamed buffers work again (broke in r190691).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-format')
-rw-r--r-- | tools/clang-format/clang-format.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/clang-format/clang-format.py b/tools/clang-format/clang-format.py index c333e4dd14..f5a57569db 100644 --- a/tools/clang-format/clang-format.py +++ b/tools/clang-format/clang-format.py @@ -48,9 +48,10 @@ if sys.platform.startswith('win32'): startupinfo.wShowWindow = subprocess.SW_HIDE # Call formatter. -p = subprocess.Popen([binary, '-lines', lines, '-style', style, - '-cursor', str(cursor), - '-assume-filename', vim.current.buffer.name], +command = [binary, '-lines', lines, '-style', style, '-cursor', str(cursor)] +if vim.current.buffer.name: + command.extend(['-assume-filename', vim.current.buffer.name]) +p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, startupinfo=startupinfo) stdout, stderr = p.communicate(input=text) |