[llvm-dev] lit: dependent substitutions?

Kim Gräsman via llvm-dev llvm-dev at lists.llvm.org
Mon Jan 1 04:59:16 PST 2018


Hi all,

Not sure if there's a better forum for lit discussion, please advise.

I'm experimenting with lit for IWYU testing. We're a little sensitive
to relative vs absolute paths, especially when trying to determine the
include-name for various headers. I've noticed lit always expands
substitutions (e.g. %s) to absolute paths, and I'd like to be able to
introduce substitutions for the source path relative to the source
root. This seems generally useful -- if there was a way in lit.cfg to
register a function for substitution instead of a simple pair, we
could do stuff like:

    config.xsubstitutions.append(('%r', lambda s: os.path.relpath(s,
some_root)))

Most of the simple builtin substitutions are variations on this theme,
so I guess they could be implemented similarly.

Is this a useful direction? Would you accept lit patches to that end?

Thanks,
- Kim


More information about the llvm-dev mailing list