diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-03-09 00:06:10 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-03-09 00:06:10 +0000 |
| commit | d5453b2c3f72e27f0cefe3003252f49462a419f9 (patch) | |
| tree | f0fec37e6f642066a5ab75d3a0d1889467b3e7f1 /llvm/utils/lit | |
| parent | 08126e7eaa3a224263a0c9101a11da1a82295190 (diff) | |
| download | bcm5719-llvm-d5453b2c3f72e27f0cefe3003252f49462a419f9.tar.gz bcm5719-llvm-d5453b2c3f72e27f0cefe3003252f49462a419f9.zip | |
utils: add a helper class to lit for captured substitutions
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.
llvm-svn: 327082
Diffstat (limited to 'llvm/utils/lit')
| -rw-r--r-- | llvm/utils/lit/lit/TestingConfig.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py index 80a848b8e94..713baa620a7 100644 --- a/llvm/utils/lit/lit/TestingConfig.py +++ b/llvm/utils/lit/lit/TestingConfig.py @@ -152,3 +152,22 @@ class TestingConfig: else: return self.parent.root +class SubstituteCaptures: + """ + Helper class to indicate that the substitutions contains backreferences. + + This can be used as the following in lit.cfg to mark subsitutions as having + back-references:: + + config.substutions.append(('\b[^ ]*.cpp', SubstituteCaptures('\0.txt'))) + + """ + def __init__(self, substitution): + self.substitution = substitution + + def replace(self, pattern, replacement): + return self.substitution + + def __str__(self): + return self.substitution + |

