summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-format/clang-format.py
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-09-13 13:40:24 +0000
committerDaniel Jasper <djasper@google.com>2013-09-13 13:40:24 +0000
commite488f5dd1ea9a5eaec8862135a140c63b7452515 (patch)
tree48b7cfb930d700f88224f12302396d7e37608af7 /clang/tools/clang-format/clang-format.py
parent0da35401ce584e3b710b720f1b1a7db35c46b24d (diff)
downloadbcm5719-llvm-e488f5dd1ea9a5eaec8862135a140c63b7452515.tar.gz
bcm5719-llvm-e488f5dd1ea9a5eaec8862135a140c63b7452515.zip
clang-format: Add -assume-filename option for editor integrations.
With -style=file, clang-format now starts to search for a .clang-format file starting at the file given with -assume-filename if it reads from stdin. Otherwise, it would start searching from the current directory, which is not helpful for editor integrations. Also changed vim, emacs and sublime integrations to actually make use of this flag. This fixes llvm.org/PR17072. llvm-svn: 190691
Diffstat (limited to 'clang/tools/clang-format/clang-format.py')
-rw-r--r--clang/tools/clang-format/clang-format.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index d8338ab4dae..c333e4dd142 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -49,7 +49,8 @@ if sys.platform.startswith('win32'):
# Call formatter.
p = subprocess.Popen([binary, '-lines', lines, '-style', style,
- '-cursor', str(cursor)],
+ '-cursor', str(cursor),
+ '-assume-filename', vim.current.buffer.name],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE, startupinfo=startupinfo)
stdout, stderr = p.communicate(input=text)
OpenPOWER on IntegriCloud