llvm.org GIT mirror llvm / 7a0be17
On Windows, replace each occurrence of '\' by '\\' on the replacement string. This is necessary to prevent re.sub from replacing escape sequences occurring in path. For example: llvm\tools\clang\test was replaced by llvm <tab> ools\clang <tab> est git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123070 91177308-0d34-0410-b5e6-96231b3b80d8 Francois Pichet 8 years ago
1 changed file(s) with 2 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
450450 # expression pattern a with substitution b in line ln.
451451 def processLine(ln):
452452 # Apply substitutions
453 # FIXME: Investigate why re.sub doesn't work on Windows
454453 for a,b in substitutions:
455454 if kIsWindows:
456 ln = ln.replace(a,b)
457 else:
458 ln = re.sub(a, b, ln)
455 b = b.replace("\\","\\\\")
456 ln = re.sub(a, b, ln)
459457
460458 # Strip the trailing newline and any extra whitespace.
461459 return ln.strip()