[PATCH] D62882: Use raw strings to avoid deprecation warnings in regexp patterns

Adrian McCarthy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 14:12:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
amccarth marked an inline comment as done.
Closed by commit rL362846: Fix string literals to avoid deprecation warnings in regexp patterns (authored by amccarth, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62882?vs=203616&id=203624#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62882/new/

https://reviews.llvm.org/D62882

Files:
  llvm/trunk/utils/lit/lit/TestRunner.py


Index: llvm/trunk/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py
+++ llvm/trunk/utils/lit/lit/TestRunner.py
@@ -49,7 +49,7 @@
 # This regex captures ARG.  ARG must not contain a right parenthesis, which
 # terminates %dbg.  ARG must not contain quotes, in which ARG might be enclosed
 # during expansion.
-kPdbgRegex = '%dbg\(([^)\'"]*)\)'
+kPdbgRegex = '%dbg\\(([^)\'"]*)\\)'
 
 class ShellEnvironment(object):
 
@@ -1420,14 +1420,14 @@
         # Trim trailing whitespace.
         line = line.rstrip()
         # Substitute line number expressions
-        line = re.sub('%\(line\)', str(line_number), line)
+        line = re.sub(r'%\(line\)', str(line_number), line)
 
         def replace_line_number(match):
             if match.group(1) == '+':
                 return str(line_number + int(match.group(2)))
             if match.group(1) == '-':
                 return str(line_number - int(match.group(2)))
-        line = re.sub('%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
+        line = re.sub(r'%\(line *([\+-]) *(\d+)\)', replace_line_number, line)
         # Collapse lines with trailing '\\'.
         if output and output[-1][-1] == '\\':
             output[-1] = output[-1][:-1] + line


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62882.203624.patch
Type: text/x-patch
Size: 1312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190607/bf19f87b/attachment.bin>


More information about the llvm-commits mailing list