2014-04-09 22:17:23 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Run clang-tidy in fix mode and verify the result.
|
|
|
|
|
|
|
|
INPUT_FILE=$1
|
|
|
|
CHECK_TO_RUN=$2
|
|
|
|
TEMPORARY_FILE=$3.cpp
|
|
|
|
|
|
|
|
grep -Ev "// *[A-Z-]+:" ${INPUT_FILE} > ${TEMPORARY_FILE}
|
2014-07-08 23:41:20 +08:00
|
|
|
clang-tidy ${TEMPORARY_FILE} -fix --checks="-*,${CHECK_TO_RUN}" -- --std=c++11 > ${TEMPORARY_FILE}.msg 2>&1
|
2014-07-09 00:15:48 +08:00
|
|
|
FileCheck -input-file=${TEMPORARY_FILE} ${INPUT_FILE} -strict-whitespace || exit $?
|
|
|
|
if grep CHECK-MESSAGES ${INPUT_FILE}; then
|
|
|
|
FileCheck -input-file=${TEMPORARY_FILE}.msg ${INPUT_FILE} -check-prefix=CHECK-MESSAGES || exit $?
|
|
|
|
fi
|