[PATCH] D92404: [FileCheck] Enforce --allow-unused-prefixes=false for llvm/test/Transforms

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 18:53:48 PST 2020


pengfei added a comment.

Glad to see you are using the script. I'm not very sure its behavior. Please pay attention to its changes especially marked `CHANGE`



================
Comment at: llvm/utils/update_test_prefix.py:22
-            s = re.sub('-?-check-prefixes=([^, ]+\n)', '--check-prefix=\\1', s)
-            s = re.sub('-?-check-prefixes=([^, ]+) ', '--check-prefix=\\1', s)
             t = re.search('-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)', s)
----------------
I think we just need to add a space for it:
```
s = re.sub('-?-check-prefixes=([^, ]+) ', '--check-prefix=\\1 ', s)
```
I once worried we may leave space at the end but didn't consider %s case.
`\w+` is not always correct because many prefixes are using `-` in them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92404



More information about the llvm-commits mailing list