r193433 - clang-format.py: Make formatting unnamed buffers work again (broke in r190691).

Nico Weber nicolasweber at gmx.de
Fri Oct 25 13:06:20 PDT 2013


Author: nico
Date: Fri Oct 25 15:06:20 2013
New Revision: 193433

URL: http://llvm.org/viewvc/llvm-project?rev=193433&view=rev
Log:
clang-format.py: Make formatting unnamed buffers work again (broke in r190691).


Modified:
    cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=193433&r1=193432&r2=193433&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Fri Oct 25 15:06:20 2013
@@ -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)





More information about the cfe-commits mailing list