]>
git.saurik.com Git - apple/xnu.git/blob - tools/reindent.sh
4 # Reindent CWD recursively using clang-format (assumed to be in your PATH),
5 # and per-component or per-directory .clang-format style specifications.
8 CPUS
=`sysctl -n hw.logicalcpu`
9 CLANGFORMAT
=`xcrun -find clang-format`
11 if [ ! -x "${CLANGFORMAT}" ]; then
12 echo "Could not find clang-format" 1>&2
16 echo "Using ${CLANGFORMAT} to reindent, using concurrency of ${CPUS}"
18 find -x . \
! \
( \
( -name BUILD
-o -name EXTERNAL_HEADERS
-o -name zlib
-o -name .svn
-o -name .git
-o -name cscope.\
* -o -name \
*~ \
) -prune \
) -type f \
( -name \
*.c
-o -name \
*.cpp \
) -print0 | \
19 xargs -0 -P "${CPUS}" -n 10 "${CLANGFORMAT}" -style=file -i
22 if [ $ret -ne 0 ]; then
23 echo "reindent failed: $ret" 1>&2