[llvm] Fix regular expression to guard against a repeating version string (PR #84575)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 14:17:15 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Wolfgang Pieb (wolfy1961)

<details>
<summary>Changes</summary>

A recent change [d6c2cbbc651](https://github.sie.sony.com/SIE-Private/cpu-toolchain-ppr/commit/d6c2cbbc6513bd412b34f3bf70e21b5a363b2fd9) causes the test `clang/test/utils/update_cc_test_checks/generated-funcs.test` to fail for compilers with version strings that repeat the sequence "version", such as `clang version 19.0.0 (myvendor clang version 4.0.0)`.

Making the expression preceding "\w+ version" non-greedy fix this.

Unfortunately there is no simple way to generate a test case, since it would require a change in the clang version string.

---
Full diff: https://github.com/llvm/llvm-project/pull/84575.diff


1 Files Affected:

- (modified) llvm/utils/UpdateTestChecks/common.py (+1-1) 


``````````diff
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index ecb19d233a8d1a..85b4bdd2c6dc7a 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -2189,7 +2189,7 @@ def add(var):
 
 METADATA_FILTERS = [
     (
-        r"(?<=\")(.+ )?(\w+ version )[\d.]+(?:[^\" ]*)(?: \([^)]+\))?",
+        r"(?<=\")(.+ )??(\w+ version )[\d.]+(?:[^\" ]*)(?: \([^)]+\))?",
         r"{{.*}}\2{{.*}}",
     ),  # preface with glob also, to capture optional CLANG_VENDOR
     (r'(!DIFile\(filename: ".+", directory: )".+"', r"\1{{.*}}"),

``````````

</details>


https://github.com/llvm/llvm-project/pull/84575


More information about the llvm-commits mailing list