[clang] 089d063 - [clang-format][NFC] Don't always rebuild clang-format-check-format (#203828)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 22:08:03 PDT 2026


Author: owenca
Date: 2026-06-15T22:07:59-07:00
New Revision: 089d0632a7dcc832cfe9dfeb55a9ab9458623957

URL: https://github.com/llvm/llvm-project/commit/089d0632a7dcc832cfe9dfeb55a9ab9458623957
DIFF: https://github.com/llvm/llvm-project/commit/089d0632a7dcc832cfe9dfeb55a9ab9458623957.diff

LOG: [clang-format][NFC] Don't always rebuild clang-format-check-format (#203828)

Instead, check the format of clan-format source only if the built
clang-format binary or one of the source files is newer.

Added: 
    

Modified: 
    clang/lib/Format/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index 50c0683dc9b7f..3e19151790440 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -45,9 +45,12 @@ set(check_format_depends)
 set(i 0)
 foreach(file IN LISTS files)
   add_custom_command(OUTPUT check_format_depend_${i}
-    COMMAND clang-format ${file} | 
diff  -u ${file} -
+    COMMAND clang-format ${file} | 
diff  -u ${file} - &&
+            touch check_format_depend_${i}
     VERBATIM
     COMMENT "Checking format of ${file}"
+    DEPENDS clang-format
+            ${file}
     )
   list(APPEND check_format_depends check_format_depend_${i})
   math(EXPR i ${i}+1)


        


More information about the cfe-commits mailing list