Skip to content

Commit 55ae118

Browse files
authored
[GitHub] Skip undefcheck if no relevant files changed (#126749)
If the list of filtered files was empty the check would process every file in the diff.
1 parent 1337b0f commit 55ae118

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ def pr_comment_text_for_diff(self, diff: str) -> str:
353353

354354
def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str]:
355355
files = self.filter_changed_files(changed_files)
356+
if not files:
357+
return None
356358

357359
# Use git to find files that have had a change in the number of undefs
358360
regex = "([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)"
@@ -379,10 +381,6 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
379381
# Each file is prefixed like:
380382
# diff --git a/file b/file
381383
for file in re.split("^diff --git ", stdout, 0, re.MULTILINE):
382-
# We skip checking in MIR files as undef is a valid token and not
383-
# going away.
384-
if file.endswith(".mir"):
385-
continue
386384
# search for additions of undef
387385
if re.search(r"^[+](?!\s*#\s*).*(\bundef\b|UndefValue::get)", file, re.MULTILINE):
388386
files.append(re.match("a/([^ ]+)", file.splitlines()[0])[1])

0 commit comments

Comments
 (0)