[PATCH] D92542: [tools] Update update_test_prefix.py to handle %s after prefixes

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 22:55:35 PST 2020


pengfei added inline comments.


================
Comment at: llvm/utils/update_test_prefix.py:21
         else:
-            s = re.sub('-?-check-prefixes=([^, ]+\n)', '--check-prefix=\\1', s)
-            s = re.sub('-?-check-prefixes=([^, ]+) ', '--check-prefix=\\1', s)
+            s = re.sub('-?-check-prefixes=([\w-]+[\s]*) ', '--check-prefix=\\1', s)
             t = re.search('-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)', s)
----------------
I checked it and find it didn't work. It seems `\w` in `[]` loses its function.
I also think the `*` after `[\s]` (you can use `\s` without `[]`) is problematical for `--check-prefixes=A,B`. Besides, changing to `+` is still problematical for it may consume extera blank lines.
It's hard to modify regular expression correctly without lots of checks, I think you can use my previous patch as a test:
```
git reset --hard c22dc71b120b066c0066b8517014149a001cc2b0^1
git show c22dc71b120b066c0066b8517014149a001cc2b0 --stat | grep "llvm/test" | cut -d " " -f 2 | xargs llvm/utils/update_test_prefix.py
```
Check if the outputs are identical to the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92542/new/

https://reviews.llvm.org/D92542



More information about the llvm-commits mailing list