[clang] [Clang][C++26] Implement "Ordering of constraints involving fold expressions (PR #98160)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 09:07:04 PDT 2024
================
@@ -143,13 +148,116 @@ struct NormalizedConstraint {
return Constraint.get<AtomicConstraint *>();
}
+ FoldExpandedConstraint *getFoldExpandedConstraint() const {
+ assert(isFoldExpanded() &&
+ "getFoldExpandedConstraint called on non-fold-expanded constraint.");
+ return Constraint.get<FoldExpandedConstraint *>();
+ }
+
private:
static std::optional<NormalizedConstraint>
fromConstraintExprs(Sema &S, NamedDecl *D, ArrayRef<const Expr *> E);
static std::optional<NormalizedConstraint>
fromConstraintExpr(Sema &S, NamedDecl *D, const Expr *E);
};
+struct FoldExpandedConstraint {
+ enum class FoldOperatorKind { FoAnd, FoOr } Kind;
+ NormalizedConstraint Constraint;
+ const Expr *Pattern;
+
+ FoldExpandedConstraint(FoldOperatorKind K, NormalizedConstraint C,
+ const Expr *Pattern)
+ : Kind(K), Constraint(std::move(C)), Pattern(Pattern) {};
+
+ template <typename AtomicSubsumptionEvaluator>
+ bool subsumes(const FoldExpandedConstraint &Other,
+ AtomicSubsumptionEvaluator E) const;
+
+ static bool AreSubsumptionElligible(const FoldExpandedConstraint &A,
----------------
AaronBallman wrote:
typo: `Elligible` -> `Eligible`
`Are` -> `Is` for better grammar; or `IsEligibleForSubsumption`
https://github.com/llvm/llvm-project/pull/98160
More information about the cfe-commits
mailing list