https://github.com/owenca updated 
https://github.com/llvm/llvm-project/pull/205036

>From e04a3d6c174b29ace3f599d5dbfe8a6e234cb4b8 Mon Sep 17 00:00:00 2001
From: Owen Pan <[email protected]>
Date: Sun, 21 Jun 2026 22:59:57 -0700
Subject: [PATCH] [clang-format] Use fc on Windows if diff is unavailable

---
 clang/lib/Format/CMakeLists.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index 3e19151790440..1b70588b576d9 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -41,11 +41,19 @@ file(GLOB_RECURSE files
   ${CLANG_SOURCE_DIR}/unittests/Format/*.h
   )
 
+set(diff_cmd "diff" "-u")
+if(WIN32)
+  find_program(DIFF_EXE diff)
+  if(NOT DIFF_EXE)
+    set(diff_cmd "fc")
+  endif()
+endif()
+
 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_cmd} ${file} - &&
             touch check_format_depend_${i}
     VERBATIM
     COMMENT "Checking format of ${file}"

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to