[llvm] 3e28e1e - [code-format] Also include libc++ extensionless headers and .inc and .cppm (#73142)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:03:09 PST 2023


Author: Louis Dionne
Date: 2023-11-22T13:03:05-05:00
New Revision: 3e28e1ec56c72c5f401fcc76f5590ece692d2425

URL: https://github.com/llvm/llvm-project/commit/3e28e1ec56c72c5f401fcc76f5590ece692d2425
DIFF: https://github.com/llvm/llvm-project/commit/3e28e1ec56c72c5f401fcc76f5590ece692d2425.diff

LOG: [code-format] Also include libc++ extensionless headers and .inc and .cppm (#73142)

These headers were skipped by the job because they didn't have an
extension. However, such headers are extremely common in libc++.

As a drive-by change, also include `.cppm` and `.inc` extensions since
those are also common in libc++.

Added: 
    

Modified: 
    llvm/utils/git/code-format-helper.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 32745768dc74c4d..e71ed4ee093ac0a 100644
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -126,13 +126,18 @@ def should_be_excluded(self, path: str) -> bool:
             return True
         return False
 
+    def should_include_extensionless_file(self, path: str) -> bool:
+        return path.startswith("libcxx/include")
+
     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"):
+            if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx", ".inc", ".cppm"):
                 if not self.should_be_excluded(path):
                     filtered_files.append(path)
+            elif ext == "" and self.should_include_extensionless_file(path):
+                filtered_files.append(path)
         return filtered_files
 
     def format_run(


        


More information about the llvm-commits mailing list