aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/clang-format/clang-format-diff.py
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@redhat.com>2019-02-11 15:03:17 +0000
committerSerge Guelton <sguelton@redhat.com>2019-02-11 15:03:17 +0000
commit3331b6eab3976fbfa2afc196d37667036f3f4967 (patch)
tree002d4146b3d95bc2bc573f300a13b09f64dfd7f0 /clang/tools/clang-format/clang-format-diff.py
parent83e68854d54509e7536f32e4b4aa07e1ad25ec19 (diff)
downloadllvm-3331b6eab3976fbfa2afc196d37667036f3f4967.zip
llvm-3331b6eab3976fbfa2afc196d37667036f3f4967.tar.gz
llvm-3331b6eab3976fbfa2afc196d37667036f3f4967.tar.bz2
[tools] Fix python DeprecationWarning: invalid escape sequence
The python documentation says "it’s highly recommended that you use raw strings for all but the simplest expressions." (https://docs.python.org/3/library/re.html) So do that with the attached patch generated by sed -i -e "s/re.search('/re.search(r'/g" $(git grep -l 're.search(') The warning can be seen in e.g. python3.7: $ python3.7 -Wd >>> import re; re.search('\s', '') <stdin>:1: DeprecationWarning: invalid escape sequence \s Commited on behalf of Marco Falke. Differential Revision: https://reviews.llvm.org/D57528 llvm-svn: 353707
Diffstat (limited to 'clang/tools/clang-format/clang-format-diff.py')
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index 919c09b..3ba0abefc 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -66,7 +66,7 @@ def main():
filename = None
lines_by_file = {}
for line in sys.stdin:
- match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
+ match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
if match:
filename = match.group(2)
if filename == None:
@@ -79,7 +79,7 @@ def main():
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
continue
- match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
+ match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line)
if match:
start_line = int(match.group(1))
line_count = 1