Page MenuHomePhabricator

[lit] Add --show-substitutions
Needs ReviewPublic

Authored by eush on Oct 28 2018, 5:07 AM.



This adds a flag for llvm-lit to print all substitutions for each discovered
test suite as suggested in

This flag can be used to quickly look up all defined substitutions for a
given configuration without diving into Lit configs.

The implementation tries to minimize escaping but also avoid ambiguity, so in
the output quoted keys/values are always escaped, and unquoted keys/values are
always literal.

Diff Detail

Event Timeline

eush created this revision.Oct 28 2018, 5:07 AM
delcypher added inline comments.Nov 1 2018, 6:20 AM

Why is showing substitutions coupled with listing the test suites?


Is all this regex really necessary? Couldn't we just always print repr(pattern), repr(replacement)?

eush added inline comments.Nov 1 2018, 6:42 AM

Substitutions are defined per test suite, so we have to list test suites anyway. We could hide some lines though
(such as available features).


My only concern is that otherwise it would be harder to read regexes since they would be (doubly) escaped.

delcypher added inline comments.Jan 24 2019, 3:57 AM

Then why even use repr(...)? Just print as a regular string always.


>>> print(repr(r'\s\w'))
>>> print(str(r'\s\w'))

I honestly don't understand what your regex logic is trying to achieve so I really think you should drop it.

@eush Also sorry for the delay. I just noticed that this patch was in my list of unreviewed patches. Please feel free to ping me on this review if I don't respond in a timely manner.

Thanks for doing this.

Apart from the regexp pretty-printing, this LGTM.


[nits] the parenthesis around the tuple are not needed.


I agree with @delcypher . Just printing the pattern « as is » should be fine.

jdenny added a subscriber: jdenny.Apr 15 2020, 6:46 AM

FYI: A similar patch already went in: D77818

serge-sans-paille resigned from this revision.Mar 9 2021, 12:28 AM

This bug should probably be closed then

Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2021, 12:28 AM