From d2dee948a4ae9d8c7fb7caa06ec40ed992023be2 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 21 Aug 2025 04:15:06 -0700 Subject: [PATCH] [MLIR] Improve clang-tidy script This just helping to better keep track of the failures. --- mlir/utils/clang-tidy/apply-clang-tidy.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mlir/utils/clang-tidy/apply-clang-tidy.sh b/mlir/utils/clang-tidy/apply-clang-tidy.sh index a3592187361e..f0973dd73d7e 100755 --- a/mlir/utils/clang-tidy/apply-clang-tidy.sh +++ b/mlir/utils/clang-tidy/apply-clang-tidy.sh @@ -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