[llvm-branch-commits] [llvm] e51c2d6 - [tools] Update update_test_prefix.py to handle %s after prefixes

Mircea Trofin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Dec 3 20:15:41 PST 2020


Author: Mircea Trofin
Date: 2020-12-03T20:07:28-08:00
New Revision: e51c2d6a747d8c85dee711edd3a766f036635da0

URL: https://github.com/llvm/llvm-project/commit/e51c2d6a747d8c85dee711edd3a766f036635da0
DIFF: https://github.com/llvm/llvm-project/commit/e51c2d6a747d8c85dee711edd3a766f036635da0.diff

LOG: [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

Added: 
    

Modified: 
    llvm/utils/update_test_prefix.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/update_test_prefix.py b/llvm/utils/update_test_prefix.py
index 9d383cae6f9f..28122cc34c40 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)


        


More information about the llvm-branch-commits mailing list