[llvm] b416e7f - [CI] adjust the undef warning regex so it doesn't catch %undef in .ll files

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 08:56:42 PDT 2025


Author: Nuno Lopes
Date: 2025-04-08T16:56:38+01:00
New Revision: b416e7f5920ff2f80f60e52eeb363269d130adba

URL: https://github.com/llvm/llvm-project/commit/b416e7f5920ff2f80f60e52eeb363269d130adba
DIFF: https://github.com/llvm/llvm-project/commit/b416e7f5920ff2f80f60e52eeb363269d130adba.diff

LOG: [CI] adjust the undef warning regex so it doesn't catch %undef in .ll files

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 da1b4cdad6978..69d654b87e856 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -387,13 +387,11 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
         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"
+                undef_regex = r"(?<!%)\bundef\b"
             else:
                 undef_regex = r"UndefValue::get"
             # search for additions of undef
-            if re.search(
-                r"^[+](?!\s*#\s*).*(" + undef_regex + r")", file, re.MULTILINE
-            ):
+            if re.search(r"^[+].*" + undef_regex, file, re.MULTILINE):
                 files.append(filename)
 
         if not files:


        


More information about the llvm-commits mailing list