[llvm] [code-format] Also include libc++ extensionless headers (PR #73142)

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 08:34:57 PST 2023


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/73142

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

>From 60b6c0453b1a4a49487fcf26f896db57ea1db990 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 22 Nov 2023 11:33:33 -0500
Subject: [PATCH] [code-format] Also include libc++ extensionless headers

These headers were skipped by the job because they didn't have an
extension. However, such headers are extremely common in libc++.
---
 llvm/utils/git/code-format-helper.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 32745768dc74c4d..2e02c911a9a830a 100644
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -126,6 +126,9 @@ 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:
@@ -133,6 +136,8 @@ def filter_changed_files(self, changed_files: list[str]) -> list[str]:
             if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx"):
                 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