Author: djasper Date: Wed Jan 20 12:55:57 2016 New Revision: 258328 URL: http://llvm.org/viewvc/llvm-project?rev=258328&view=rev Log: clang-format-diff: Replace hard-code default for clang-format binary with flag.
Patch by Kwasi Mensah, thank you. Modified: cfe/trunk/tools/clang-format/clang-format-diff.py Modified: cfe/trunk/tools/clang-format/clang-format-diff.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py?rev=258328&r1=258327&r2=258328&view=diff ============================================================================== --- cfe/trunk/tools/clang-format/clang-format-diff.py (original) +++ cfe/trunk/tools/clang-format/clang-format-diff.py Wed Jan 20 12:55:57 2016 @@ -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: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits