[PATCH] D38565: [lit] Improve the ToolSubst class a bit
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 5 14:15:26 PDT 2017
zturner updated this revision to Diff 117887.
zturner added a comment.
Herald added a subscriber: fedor.sergeev.
This got a little bit more complicated. There were a lot of latent issues and inconsistencies in the way we added tool substitutions, but I think these are all gone now and everything is consistent.
The main change here is the improvements to the `ToolSubst` class to customize various parts of the substitution algorithm. The idea being twofold:
1. Take this logic away from the person providing the name of the tool, so that everybody doesn't do it a little bit differently.
2. Provide a way to specify more complex subsitution handling behavior, such as what happens when a tool can't be found, or how to find a tool (Sometimes people would look in the os PATH, sometimes in a specific set of directories, sometimes in the configuration's PATH.
For an example of #1, there was the ability to specify before and after characters that should fail a match, so that for example if a substitution is `llc`, then you won't match `/llc` when it is used as part of a path, or `llc.exe` when it used as a filename. But not all tools followed these guidelines, and it was done (unnecessarily) on a case-by-case basis without people understanding when/why to do it. And it didn't even handle everything, like a \ in front of a path (it always assume / paths). Now, you have to go out of your way to avoid the default behavior, which is almost always correct.
For #2, the motivation for this is that I want to provide a standardized set of substitutions for a tool. So that for example, `debuginfo-tests` can say `use_clang()` and lld can say `use_clang()` and get the same substitutions that lld and clang themselves use. But if lld fails to find its tools, then that's a fatal error, whereas if `debuginfo-tests` can't find lld tools, that's expected in certain scenarios. So the ability to customize this is needed.
As an aside, this patch exposed a bug in an existing test where `clang-cc1` was being used instead of `%clang_cc1`, so that is fixed here.
https://reviews.llvm.org/D38565
Files:
clang/test/Index/recover-bad-code-rdar_7487294.c
clang/test/lit.cfg.py
lld/test/lit.cfg.py
llvm/test/lit.cfg.py
llvm/utils/lit/lit/llvm/__init__.py
llvm/utils/lit/lit/llvm/config.py
llvm/utils/lit/lit/llvm/subst.py
llvm/utils/lit/lit/util.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38565.117887.patch
Type: text/x-patch
Size: 59047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/e77e54d7/attachment.bin>
More information about the llvm-commits
mailing list