summaryrefslogtreecommitdiffstats
path: root/Utilities/Scripts
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-02-23 12:35:32 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-02-23 12:35:32 (GMT)
commitd23f4414c44b977abc3f9ff49aa06f709a3d9db1 (patch)
tree1302fa37f072c825d19da60c20edf31c8cdffe0a /Utilities/Scripts
parente68aad3eb88b910266b7af3f80f9ee8a6370401c (diff)
parentd5f39a56a44fe061018c6acc15e1c3aa7337ff54 (diff)
downloadCMake-d23f4414c44b977abc3f9ff49aa06f709a3d9db1.zip
CMake-d23f4414c44b977abc3f9ff49aa06f709a3d9db1.tar.gz
CMake-d23f4414c44b977abc3f9ff49aa06f709a3d9db1.tar.bz2
Merge topic 'clang-format-attrs'
d5f39a56 clang-format.bash: Use Git attributes to mark files for formatting f6986ee4 Define a custom Git attribute to mark sources using our C style 2256c3a7 Define a custom Git attribute to mark source files as generated
Diffstat (limited to 'Utilities/Scripts')
-rwxr-xr-xUtilities/Scripts/clang-format.bash36
1 files changed, 7 insertions, 29 deletions
diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash
index 2b36ac5..edcda77 100755
--- a/Utilities/Scripts/clang-format.bash
+++ b/Utilities/Scripts/clang-format.bash
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#=============================================================================
-# Copyright 2015-2016 Kitware, Inc.
+# Copyright 2015-2017 Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -106,34 +106,12 @@ case "$mode" in
*) die "invalid mode: $mode" ;;
esac
-# Filter sources to which our style should apply.
-$git_ls -z -- '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' '*.cu' '*.notcu' |
+# List files as selected above.
+$git_ls |
- # Exclude lexer/parser generator input and output.
- egrep -z -v '^Source/cmCommandArgumentLexer\.' |
- egrep -z -v '^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmDependsJavaLexer\.' |
- egrep -z -v '^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmExprLexer\.' |
- egrep -z -v '^Source/cmExprParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmFortranLexer\.' |
- egrep -z -v '^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmListFileLexer(\.in\.l|\.c)' |
-
- # Exclude third-party sources.
- egrep -z -v '^Source/bindexplib' |
- egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
- egrep -z -v '^Utilities/(KW|cm).*/' |
-
- # Exclude reference content.
- egrep -z -v '^Tests/RunCMake/GenerateExportHeader/reference/' |
-
- # Exclude manually-formatted sources (e.g. with long lines).
- egrep -z -v '^Tests/PositionIndependentTargets/pic_test.h' |
- egrep -z -v '^Tests/CompileFeatures/cxx_right_angle_brackets.cpp' |
-
- # Exclude sources with encoding not suported by clang-format.
- egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
+ # Select sources with our attribute.
+ git check-attr --stdin format.clang-format |
+ sed -n '/: format\.clang-format: set$/ {s/:[^:]*:[^:]*$//p}' |
# Update sources in-place.
- xargs -0 "$clang_format" -i
+ xargs -d '\n' "$clang_format" -i