[libcxx-commits] [clang] [libcxx] [Clang] Normalize constraints before checking for satisfaction (PR #141776)
Corentin Jabot via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 19 03:02:37 PDT 2025
================
@@ -16,130 +16,385 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/ExprConcepts.h"
#include "clang/Basic/SourceLocation.h"
+#include "clang/Sema/Ownership.h"
#include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include <optional>
#include <utility>
namespace clang {
class Sema;
+class MultiLevelTemplateArgumentList;
-enum { ConstraintAlignment = 8 };
+/// \brief A normalized constraint, as defined in C++ [temp.constr.normal], is
+/// either an atomic constraint, a conjunction of normalized constraints or a
+/// disjunction of normalized constraints.
+struct NormalizedConstraint {
+
+ enum class ConstraintKind : unsigned char {
+ Atomic = 0,
+ ConceptId,
+ FoldExpanded,
+ Compound,
+ };
+
+ enum CompoundConstraintKind : unsigned char {
+ CCK_Conjunction,
+ CCK_Disjunction
+ };
+ enum class FoldOperatorKind : unsigned char { And, Or };
----------------
cor3ntin wrote:
They all are different things. I would prefer they remain separate to match the wording
A constraint can be either a Compound constraint, or a FoldExpanded constraint.
a Compound constraint can be either a conjunction or a disjunction.
a FoldExpanded has an operator. the reason we have an enum for that instead of reusing `BinaryOperatorKind` is that we don't need/want to use more than one bits (and none of the operator produce a fold expanded constraint)
https://github.com/llvm/llvm-project/pull/141776
More information about the libcxx-commits
mailing list