From 73e9431d545cdbb8b61d1c9e7930832162e6011f Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 25 Oct 2013 20:06:20 +0000 Subject: 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 --- tools/clang-format/clang-format.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/clang-format') 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) -- cgit v1.2.3