aboutsummaryrefslogtreecommitdiff
path: root/clang/tools
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-10-25 20:06:20 +0000
committerNico Weber <nicolasweber@gmx.de>2013-10-25 20:06:20 +0000
commit8bdd1ee0216ff4a11b58eaa744646fc06efdfc35 (patch)
treefcaa8273d76e0055229bbb5873156a56dcbfd581 /clang/tools
parent8bc7db777d5ace45ed35c562314a1c2d5f629e8a (diff)
downloadllvm-8bdd1ee0216ff4a11b58eaa744646fc06efdfc35.zip
llvm-8bdd1ee0216ff4a11b58eaa744646fc06efdfc35.tar.gz
llvm-8bdd1ee0216ff4a11b58eaa744646fc06efdfc35.tar.bz2
clang-format.py: Make formatting unnamed buffers work again (broke in r190691).
llvm-svn: 193433
Diffstat (limited to 'clang/tools')
-rw-r--r--clang/tools/clang-format/clang-format.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index c333e4d..f5a5756 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/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)