From e51c2d6a747d8c85dee711edd3a766f036635da0 Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Wed, 2 Dec 2020 21:32:28 -0800 Subject: [PATCH] [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 --- llvm/utils/update_test_prefix.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/utils/update_test_prefix.py b/llvm/utils/update_test_prefix.py index 9d383ca..28122cc 100755 --- a/llvm/utils/update_test_prefix.py +++ b/llvm/utils/update_test_prefix.py @@ -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) -- 2.7.4