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

Sometimes the check-prefixes is followed by %s, and we want to keep a
white space before it.

Differential Revision: https://reviews.llvm.org/D92542
This commit is contained in:
Mircea Trofin 2020-12-02 21:32:28 -08:00
parent 9378a366b2
commit e51c2d6a74
1 changed files with 1 additions and 2 deletions

View File

@ -18,8 +18,7 @@ def remove_prefix(i, d=0):
s = re.sub(',' + p + '([, \n])', '\\1', s)
s = re.sub('\s+-?-check-prefix=' + p + '([ \n])', '\\1', s)
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-]+)(\Z|[ \t\n])', '--check-prefix=\\1\\2', s)
t = re.search('-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)', s)
while t:
s = re.sub(t.group(), '--check-prefixes=' + t.group(1) + ',' + t.group(2), s)