summaryrefslogtreecommitdiff
path: root/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/clang-format/clang-format-diff.py')
-rwxr-xr-xtools/clang-format/clang-format-diff.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
index ab5f1b1bc630..68b5113d92f6 100755
--- a/tools/clang-format/clang-format-diff.py
+++ b/tools/clang-format/clang-format-diff.py
@@ -63,9 +63,10 @@ def formatRange(r, style):
offset, length = getOffsetLength(filename, line_number, line_count)
with open(filename, 'r') as f:
text = f.read()
- p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length),
- '-style', style],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ command = [binary, '-offset', str(offset), '-length', str(length)]
+ if style:
+ command.extend(['-style', style])
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
stdout, stderr = p.communicate(input=text)
if stderr:
@@ -84,8 +85,8 @@ def main():
'Reformat changed lines in diff')
parser.add_argument('-p', default=1,
help='strip the smallest prefix containing P slashes')
- parser.add_argument('-style', default='LLVM',
- help='formatting style to apply (LLVM, Google)')
+ parser.add_argument('-style',
+ help='formatting style to apply (LLVM, Google, Chromium)')
args = parser.parse_args()
filename = None