[llvm] [CI] enable code-format-helper for .cl files (PR #135748)

Wenju He via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 22:40:57 PDT 2025


https://github.com/wenju-he updated https://github.com/llvm/llvm-project/pull/135748

>From 1b29c187280c8542c738cb81bb9014c6ffc7f415 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Mon, 14 Apr 2025 22:22:58 -0700
Subject: [PATCH 1/2] [CI] enable code-format-helper for .cl files

In clang-format, OpenCL .cl file uses default C++ formatting.
There are many pull-requests in libclc project that change OpenCL files.
It is beneficial to enable clang-format for them in CI.
---
 llvm/utils/git/code-format-helper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 69d654b87e856..aed655234134c 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -186,7 +186,7 @@ def filter_changed_files(self, changed_files: List[str]) -> List[str]:
         filtered_files = []
         for path in changed_files:
             _, ext = os.path.splitext(path)
-            if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx", ".inc", ".cppm"):
+            if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx", ".inc", ".cppm", ".cl"):
                 filtered_files.append(path)
             elif ext == "" and self.should_include_extensionless_file(path):
                 filtered_files.append(path)

>From 4eae67bdf705cda100b2a2cb904528a80b052a1d Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Mon, 14 Apr 2025 22:40:41 -0700
Subject: [PATCH 2/2] format

---
 llvm/utils/git/code-format-helper.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index aed655234134c..ee44ac3fc5da2 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -186,7 +186,17 @@ def filter_changed_files(self, changed_files: List[str]) -> List[str]:
         filtered_files = []
         for path in changed_files:
             _, ext = os.path.splitext(path)
-            if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx", ".inc", ".cppm", ".cl"):
+            if ext in (
+                ".cpp",
+                ".c",
+                ".h",
+                ".hpp",
+                ".hxx",
+                ".cxx",
+                ".inc",
+                ".cppm",
+                ".cl",
+            ):
                 filtered_files.append(path)
             elif ext == "" and self.should_include_extensionless_file(path):
                 filtered_files.append(path)



More information about the llvm-commits mailing list