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

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 20:58:06 PST 2020


mtrofin added a comment.

In D92404#2430040 <https://reviews.llvm.org/D92404#2430040>, @pengfei wrote:

> 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)
----------------
pengfei wrote:
> 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.
how about 

s = re.sub('-?-check-prefixes=([\w_-]+)', '--check-prefix=\\1', s)

So it'd avoid the extra space, too? Or do we allow other characters?


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