[clang] [Windows] Add git-clang-format wrapper bat file (PR #69228)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 10:15:20 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Chris B (llvm-beanz)

<details>
<summary>Changes</summary>

This allows git-clang-format to be used on a Windows terminal without manually needing to find the path and invoke the python interpreter. We have a similar script for `scan-build`.

---
Full diff: https://github.com/llvm/llvm-project/pull/69228.diff


2 Files Affected:

- (modified) clang/tools/clang-format/CMakeLists.txt (+6) 
- (added) clang/tools/clang-format/git-clang-format.bat (+1) 


``````````diff
diff --git a/clang/tools/clang-format/CMakeLists.txt b/clang/tools/clang-format/CMakeLists.txt
index 30c93f8667c8359..1c61a3c8fb80368 100644
--- a/clang/tools/clang-format/CMakeLists.txt
+++ b/clang/tools/clang-format/CMakeLists.txt
@@ -38,3 +38,9 @@ install(FILES clang-format.py
 install(PROGRAMS git-clang-format
   DESTINATION "${CMAKE_INSTALL_BINDIR}"
   COMPONENT clang-format)
+
+if (WIN32 AND NOT CYGWIN)
+  install(PROGRAMS git-clang-format.bat
+    DESTINATION "${CMAKE_INSTALL_BINDIR}"
+    COMPONENT clang-format)
+endif()
diff --git a/clang/tools/clang-format/git-clang-format.bat b/clang/tools/clang-format/git-clang-format.bat
new file mode 100644
index 000000000000000..d4bc5172989cb09
--- /dev/null
+++ b/clang/tools/clang-format/git-clang-format.bat
@@ -0,0 +1 @@
+py -3 git-clang-format %*

``````````

</details>


https://github.com/llvm/llvm-project/pull/69228


More information about the cfe-commits mailing list