[ClangFormat] Editor integrations inherit default style from clang-format binary
Summary:
This allows downstream customizations to the default style to work without
needing to also modify the editor integrations.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49719
git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@360996 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/clang-format.py b/clang-format.py
index fe068bd..0c772f9 100644
--- a/clang-format.py
+++ b/clang-format.py
@@ -44,7 +44,7 @@
# 'clang-format --help' for a list of supported styles. The default looks for
# a '.clang-format' or '_clang-format' file to indicate the style that should be
# used.
-style = 'file'
+style = None
fallback_style = None
if vim.eval('exists("g:clang_format_fallback_style")') == "1":
fallback_style = vim.eval('g:clang_format_fallback_style')
@@ -91,9 +91,11 @@
startupinfo.wShowWindow = subprocess.SW_HIDE
# Call formatter.
- command = [binary, '-style', style, '-cursor', str(cursor)]
+ command = [binary, '-cursor', str(cursor)]
if lines != ['-lines', 'all']:
command += lines
+ if style:
+ command.extend(['-style', style])
if fallback_style:
command.extend(['-fallback-style', fallback_style])
if vim.current.buffer.name: