Files
clang-p2996/polly/utils/check_format.sh
Johannes Doerfert 9e7b17b0d4 Added arcanist linters and cleaned errors and warnings
Arcanist (arc) will now always run linters before uploading any new
  commit to Phabricator. All errors/warnings (or their absence) will be
  shown in the web interface together with a explanation by the commiter
  (arcanist will ask the commiter if the build was not clean).

  The linters include:
    - clang-format
    - spelling check
    - permissions check (aka. chmod)
    - filename check
    - merge conflict marker check
  Note, that their scope is sometimes limited (see .arclint for
  details).

  This commit also fixes all errors and warnings these linters reported,
  namely:
    - spelling mistakes and typos
    - executable permissions for various text files

Differential Revision: http://reviews.llvm.org/D4916

llvm-svn: 215871
2014-08-18 00:40:13 +00:00

32 lines
551 B
Bash
Executable File

#!/bin/bash
CLANG_FORMAT=${CLANG_FORMAT}
if [ "${CLANG_FORMAT}x" = "x" ]; then
CLANG_FORMAT=`which clang-format`
if [ "${CLANG_FORMAT}x" = "x" ]; then
echo "Error: cannot find clang-format in your path"
exit 1
fi
fi
OK=0
for ARG in "$@"
do
${CLANG_FORMAT} -style=llvm $ARG | diff -u $ARG - >&2
if [[ $? -eq 1 ]]; then
OK=1
fi
done
if [[ $OK -eq "1" ]]; then
echo "Error: clang-format reported formatting differences"
exit 1
else
echo "OK: clang-format reported no formatting differences"
exit 0
fi