[libcxx-commits] [libcxx] [llvm] [RFC][libc++][test] Improves C++ Standard filtering. (PR #89499)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 3 09:23:03 PDT 2024
================
@@ -165,11 +165,28 @@ def getSuitableClangTidy(cfg):
default=lambda cfg: next(
s for s in reversed(_allStandards) if getStdFlag(cfg, s)
),
- actions=lambda std: [
+ actions=lambda std: filter(None, [
AddFeature(std),
+
+ AddFeature("<=c++03") if std <= "c++03" else None,
+ AddFeature("<=c++11") if std <= "c++11" else None,
+ AddFeature("<=c++14") if std <= "c++14" else None,
+ AddFeature("<=c++17") if std <= "c++17" else None,
+ AddFeature("<=c++20") if std <= "c++20" else None,
+ AddFeature("<=c++23") if std <= "c++23" else None,
+ AddFeature("<=c++26") if std <= "c++26" else None,
----------------
ldionne wrote:
If we don't want to hardcode the meaning of comparing Lit features inside `BooleanExpression` (which I fully understand), perhaps we could simply make this feature look less like an operator (which people will then make assumptions about). Something like:
```
// REQUIRES: standard-at-least(c++14)
```
So instead of what you have in this patch, maybe something like:
```
Parameter(
name="std",
choices=_allStandards,
type=str,
help="The version of the standard to compile the test suite with.",
default=lambda cfg: getDefaultStdValue(cfg),
actions=lambda std: [
AddFeature(std),
AddSubstitution("%{cxx_std}", re.sub(r"\+", "x", std)),
AddCompileFlag(lambda cfg: getStdFlag(cfg, std)),
] + [AddFeature(f"standard-at-least({s})") for s in _allStandards if s < std],
),
```
This is basically the same thing you're doing but we use `standard-at-least(...)` instead of an operator.
https://github.com/llvm/llvm-project/pull/89499
More information about the libcxx-commits
mailing list