[llvm] e1fc118 - [CI] Reduce false positives in undef checker (#134687)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 01:53:37 PDT 2025
Author: Benjamin Maxwell
Date: 2025-04-08T09:53:33+01:00
New Revision: e1fc118f3a2f3fb91a3045ce37a5259430594afc
URL: https://github.com/llvm/llvm-project/commit/e1fc118f3a2f3fb91a3045ce37a5259430594afc
DIFF: https://github.com/llvm/llvm-project/commit/e1fc118f3a2f3fb91a3045ce37a5259430594afc.diff
LOG: [CI] Reduce false positives in undef checker (#134687)
Only check for diffs containing "undef" in .ll files, this prevents
comments like `// We should not have undef values...` triggering the
undef checker bot.
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 cb1e56859d083..da1b4cdad6978 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -376,14 +376,25 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
sys.stdout.write(proc.stderr)
stdout = proc.stdout
+ if not stdout:
+ return None
+
files = []
+
# Split the
diff so we have one array entry per file.
# Each file is prefixed like:
#
diff --git a/file b/file
for file in re.split("^
diff --git ", stdout, 0, re.MULTILINE):
+ filename = re.match("a/([^ ]+)", file.splitlines()[0])[1]
+ if filename.endswith(".ll"):
+ undef_regex = r"\bundef\b"
+ else:
+ undef_regex = r"UndefValue::get"
# 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])
+ if re.search(
+ r"^[+](?!\s*#\s*).*(" + undef_regex + r")", file, re.MULTILINE
+ ):
+ files.append(filename)
if not files:
return None
More information about the llvm-commits
mailing list