Skip to content

Commit 3e28e1e

Browse files
authored
[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++.
1 parent 32903b0 commit 3e28e1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,18 @@ def should_be_excluded(self, path: str) -> bool:
126126
return True
127127
return False
128128

129+
def should_include_extensionless_file(self, path: str) -> bool:
130+
return path.startswith("libcxx/include")
131+
129132
def filter_changed_files(self, changed_files: list[str]) -> list[str]:
130133
filtered_files = []
131134
for path in changed_files:
132135
_, ext = os.path.splitext(path)
133-
if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx"):
136+
if ext in (".cpp", ".c", ".h", ".hpp", ".hxx", ".cxx", ".inc", ".cppm"):
134137
if not self.should_be_excluded(path):
135138
filtered_files.append(path)
139+
elif ext == "" and self.should_include_extensionless_file(path):
140+
filtered_files.append(path)
136141
return filtered_files
137142

138143
def format_run(

0 commit comments

Comments
 (0)