diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-20 18:55:57 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-20 18:55:57 +0000 |
commit | 18b1de3ec6b33199d168807276db95c50f6faab8 (patch) | |
tree | 6d0d84df266bf4d9da98b85e0ce040106c41ccb4 /clang/tools/clang-format | |
parent | d325ab8cb885bcfed80b51ea4d5748c4e58edb7f (diff) | |
download | bcm5719-llvm-18b1de3ec6b33199d168807276db95c50f6faab8.tar.gz bcm5719-llvm-18b1de3ec6b33199d168807276db95c50f6faab8.zip |
clang-format-diff: Replace hard-code default for clang-format binary with flag.
Patch by Kwasi Mensah, thank you.
llvm-svn: 258328
Diffstat (limited to 'clang/tools/clang-format')
-rwxr-xr-x | clang/tools/clang-format/clang-format-diff.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py index 9e02bb09387..5e728f54716 100755 --- a/clang/tools/clang-format/clang-format-diff.py +++ b/clang/tools/clang-format/clang-format-diff.py @@ -31,10 +31,6 @@ import StringIO import sys -# Change this to the full path if clang-format is not on the path. -binary = 'clang-format' - - def main(): parser = argparse.ArgumentParser(description= 'Reformat changed lines in diff. Without -i ' @@ -56,10 +52,11 @@ def main(): help='let clang-format sort include blocks') parser.add_argument('-v', '--verbose', action='store_true', help='be more verbose, ineffective without -i') - parser.add_argument( - '-style', - help= - 'formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)') + parser.add_argument('-style', + help='formatting style to apply (LLVM, Google, Chromium, ' + 'Mozilla, WebKit)') + parser.add_argument('-binary', default='clang-format', + help='location of binary to use for clang-format') args = parser.parse_args() # Extract changed lines for each file. @@ -95,7 +92,7 @@ def main(): for filename, lines in lines_by_file.iteritems(): if args.i and args.verbose: print 'Formatting', filename - command = [binary, filename] + command = [args.binary, filename] if args.i: command.append('-i') if args.sort_includes: |