[PATCH] D16363: Add option to specify clang-format binary for clang-format-diff
Kwasi Mensah via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 20 10:40:01 PST 2016
kmensah created this revision.
kmensah added a reviewer: djasper.
kmensah added a subscriber: cfe-commits.
kmensah set the repository for this revision to rL LLVM.
A command line option that lets users of the script specify which clang-format binary to use. Useful if clang-format is not on PATH or you want more control over which binary gets chosen.
Repository:
rL LLVM
http://reviews.llvm.org/D16363
Files:
clang-format-diff.py
Index: clang-format-diff.py
===================================================================
--- clang-format-diff.py
+++ clang-format-diff.py
@@ -30,11 +30,8 @@
import StringIO
import sys
+binary_default = 'clang-format'
-# 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 '
@@ -60,6 +57,11 @@
'-style',
help=
'formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)')
+ parser.add_argument(
+ '-binary',
+ default=binary_default,
+ help=
+ 'location of binary to use for clang-format')
args = parser.parse_args()
# Extract changed lines for each file.
@@ -95,7 +97,7 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16363.45414.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160120/c37abfcc/attachment-0001.bin>
More information about the cfe-commits
mailing list