[MLIR] Improve clang-tidy script

This just helping to better keep track of the failures.
This commit is contained in:
Mehdi Amini 2025-08-21 04:15:06 -07:00
parent a6fcd1a663
commit d2dee948a4

View File

@ -89,7 +89,8 @@ find $SRCS | grep ".cpp$" | sort | while read file ; do
echo "-----------------------------------"
echo "-- Apply check $check on file $file"
echo "$TIMING_TIDY $CLANG_TIDY -p $BUILD_DIR $file --checks="-*,$check" -fix -fix-errors"
COMMAND=$(echo "$TIMING_TIDY $CLANG_TIDY -p $BUILD_DIR $file --checks="-*,$check" -fix -fix-errors")
echo $COMMAND
{ $TIMING_TIDY $CLANG_TIDY -p $BUILD_DIR $file --checks="-*,$check" -fix -fix-errors ; } 2>&1
git clang-format -f
if [[ $(git diff --stat) == '' ]]; then
@ -101,16 +102,19 @@ find $SRCS | grep ".cpp$" | sort | while read file ; do
# Clang-tidy sometimes update files in the build directory, erase the .inc file generate by tablegen
# to force them to be regenerated now.
find $BUILD_DIR/tools/mlir/ | grep '\.inc' | while read file ; do rm $file ; done
ninja -C $BUILD_DIR check-mlir > ${REJECT_DIR}/ninja.${check}.$(basename $file).log 2>&1
echo $COMMAND > ${REJECT_DIR}/ninja.${check}.$(basename $file).log
ninja -C $BUILD_DIR --quiet check-mlir >> ${REJECT_DIR}/${check}.$(basename $file).ninja.log 2>&1
if [[ $? != 0 ]] ; then
echo "check-mlir failed! (see ninja.${check}.${file}.log)"
[[ ! -z "$REJECT_DIR" ]] && git diff > "${REJECT_DIR}/${check}_$(basename ${file}).reject.diff"
continue
fi
rm -f ${REJECT_DIR}/ninja.${check}.$(basename $file).log
echo "-----------------------------------"
echo "-- Success, commit changes for check $check on file $file"
git clang-format -f
git commit -a -m "Apply clang-tidy fixes for $check in $(basename $file) (NFC)"
git commit -a -m "[MLIR] Apply clang-tidy fixes for $check in $(basename $file) (NFC)"
done
done