[PATCH] D67728: Scrub FileCheck regex delimiters from test checks
David Greene via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 18 12:24:35 PDT 2019
greened created this revision.
greened added reviewers: craig.topper, xbolva00, rogfer01, RKSimon, arichardson, MaskRay.
greened added a project: LLVM.
Herald added a subscriber: llvm-commits.
It's quite common for ScalarEvolution to emit a "{{" sequence, which FileCheck
will interpret as the start of a regular expression. Escape such patterns so
that we can correctly match them in the auto-generated checks.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D67728
Files:
llvm/utils/UpdateTestChecks/common.py
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -71,7 +71,8 @@
SCRUB_KILL_COMMENT_RE = re.compile(r'^ *#+ +kill:.*\n')
SCRUB_LOOP_COMMENT_RE = re.compile(
r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M)
-
+SCRUB_FILECHECK_REGEX_RE = re.compile(r'{{')
+SCRUB_FILECHECK_REGEX_REPLACEMENT = r'{{[{][{]}}'
def error(msg, test_file=None):
if test_file:
@@ -91,6 +92,8 @@
body = string.expandtabs(body, 2)
# Strip trailing whitespace.
body = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', body)
+ # Munge anything that could be interpreted as a FileCheck regexp.
+ body = SCRUB_FILECHECK_REGEX_RE.sub(SCRUB_FILECHECK_REGEX_REPLACEMENT, body)
return body
def do_scrub(body, scrubber, scrubber_args, extra):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67728.220727.patch
Type: text/x-patch
Size: 884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190918/23151c5d/attachment.bin>
More information about the llvm-commits
mailing list