This is an archive of the discontinued LLVM Phabricator instance.

utils: add a helper class to lit for captured substitutions
ClosedPublic

Authored by compnerd on Mar 7 2018, 5:41 PM.

Details

Reviewers
zturner
rnk
Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

compnerd created this revision.Mar 7 2018, 5:41 PM
rnk accepted this revision.Mar 8 2018, 10:28 AM

lgtm

utils/lit/lit/TestingConfig.py
157

Since there is no user of this in LLVM, can you put some example usage code in the docstring? In lit.cfg, use this code to create substitutions with regex backreferences:

config.substutions.append(('\b[^ ]*.cpp', SubstituteCaptures('\0.txt')))
This revision is now accepted and ready to land.Mar 8 2018, 10:28 AM
zturner added inline comments.Mar 8 2018, 11:06 AM
utils/lit/lit/TestingConfig.py
157

Alternatively, add a lit lit test for it.

compnerd closed this revision.Mar 8 2018, 4:10 PM

SVN r327082