[PATCH] D44240: utils: add a helper class to lit for captured substitutions
Saleem Abdulrasool via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 7 17:41:36 PST 2018
compnerd created this revision.
compnerd added a reviewer: zturner.
Herald added a subscriber: delcypher.
On Windows, if the substitution contains a back reference, it would
removed due to the replacement of the escape character in lit. Create a
helper class to avoid this which will simply ignore the replacement and
mark the substitution as having capture groups being referenced.
Repository:
rL LLVM
https://reviews.llvm.org/D44240
Files:
utils/lit/lit/TestingConfig.py
Index: utils/lit/lit/TestingConfig.py
===================================================================
--- utils/lit/lit/TestingConfig.py
+++ utils/lit/lit/TestingConfig.py
@@ -152,3 +152,16 @@
else:
return self.parent.root
+class SubstituteCaptures:
+ '''
+ Helper class to indicate that the substitutions contains backreferences.
+ '''
+ def __init__(self, substitution):
+ self.substitution = substitution
+
+ def replace(self, pattern, replacement):
+ return self.substitution
+
+ def __str__(self):
+ return self.substitution
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44240.137525.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180308/2322d3e9/attachment.bin>
More information about the llvm-commits
mailing list