clang-format: Add include sorting capabilities to sublime, emacs and
clang-format-diff.py.
git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@249567 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/clang-format-diff.py b/clang-format-diff.py
index 64efb83..9e02bb0 100755
--- a/clang-format-diff.py
+++ b/clang-format-diff.py
@@ -52,6 +52,8 @@
r'|protodevel|java)',
help='custom pattern selecting file paths to reformat '
'(case insensitive, overridden by -regex)')
+ parser.add_argument('-sort-includes', action='store_true', default=False,
+ 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(
@@ -96,6 +98,8 @@
command = [binary, filename]
if args.i:
command.append('-i')
+ if args.sort_includes:
+ command.append('-sort-includes')
command.extend(lines)
if args.style:
command.extend(['-style', args.style])