[llvm] [GitHub] Skip undefcheck if no relevant files changed (PR #126749)
Aaron Siddhartha Mondal via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 07:49:59 PST 2025
https://github.com/aaronmondal created https://github.com/llvm/llvm-project/pull/126749
If the list of filtered files was empty the check would process every file in the diff.
>From f233e4d3720f5419e795d1cc1b47e204458e9c82 Mon Sep 17 00:00:00 2001
From: Aaron Siddhartha Mondal <aaron at tracemachina.com>
Date: Tue, 11 Feb 2025 16:42:08 +0100
Subject: [PATCH] [GitHub] Skip undefcheck if no relevant files changed
If the list of filtered files was empty the check would process every
file in the diff.
---
llvm/utils/git/code-format-helper.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 48a338aca9c8e6..cb1e56859d0836 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -353,6 +353,8 @@ def pr_comment_text_for_diff(self, diff: str) -> str:
def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str]:
files = self.filter_changed_files(changed_files)
+ if not files:
+ return None
# Use git to find files that have had a change in the number of undefs
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
# Each file is prefixed like:
# diff --git a/file b/file
for file in re.split("^diff --git ", stdout, 0, re.MULTILINE):
- # We skip checking in MIR files as undef is a valid token and not
- # going away.
- if file.endswith(".mir"):
- continue
# search for additions of undef
if re.search(r"^[+](?!\s*#\s*).*(\bundef\b|UndefValue::get)", file, re.MULTILINE):
files.append(re.match("a/([^ ]+)", file.splitlines()[0])[1])
More information about the llvm-commits
mailing list