13#ifndef LLVM_CLANG_SEMA_SEMACONCEPT_H
14#define LLVM_CLANG_SEMA_SEMACONCEPT_H
20#include "llvm/ADT/PointerUnion.h"
21#include "llvm/ADT/SmallVector.h"
36 ConstraintExpr(ConstraintExpr) { };
40 if (!ParameterMapping != !
Other.ParameterMapping)
42 if (!ParameterMapping)
44 if (ParameterMapping->size() !=
Other.ParameterMapping->size())
47 for (
unsigned I = 0, S = ParameterMapping->size(); I < S; ++I) {
48 llvm::FoldingSetNodeID IDA, IDB;
49 C.getCanonicalTemplateArgument((*ParameterMapping)[I].
getArgument())
51 C.getCanonicalTemplateArgument((*
Other.ParameterMapping)[I].getArgument())
72 if (ConstraintExpr !=
Other.ConstraintExpr)
76 return hasMatchingParameterMapping(C,
Other);
80struct alignas(ConstraintAlignment) FoldExpandedConstraint;
83 llvm::PointerUnion<AtomicConstraint *, FoldExpandedConstraint *>;
125 Constraint(
Other.Constraint) {
126 Other.Constraint =
nullptr;
130 if (&
Other !=
this) {
144 assert(isCompound() &&
"getCompoundKind on a non-compound constraint..");
153 "getAtomicConstraint called on non-atomic constraint.");
158 assert(isFoldExpanded() &&
159 "getFoldExpandedConstraint called on non-fold-expanded constraint.");
164 static std::optional<NormalizedConstraint>
166 static std::optional<NormalizedConstraint>
181 :
Kind(K), Constraint(
std::move(C)), Pattern(Pattern) {};
183 template <
typename AtomicSubsumptionEvaluator>
185 const AtomicSubsumptionEvaluator &
E)
const;
191const NormalizedConstraint *getNormalizedAssociatedConstraints(
192 Sema &S, NamedDecl *ConstrainedDecl,
193 ArrayRef<const Expr *> AssociatedConstraints);
195template <
typename AtomicSubsumptionEvaluator>
197 const AtomicSubsumptionEvaluator &
E) {
202 for (
const auto &Pi : PDNF) {
203 for (
const auto &Qj : QCNF) {
238template <
typename AtomicSubsumptionEvaluator>
241 const AtomicSubsumptionEvaluator &
E) {
262template <
typename AtomicSubsumptionEvaluator>
263bool FoldExpandedConstraint::subsumes(
265 const AtomicSubsumptionEvaluator &
E)
const {
272 if (
Kind !=
Other.Kind || !AreCompatibleForSubsumption(*
this,
Other))
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
enum clang::sema::@1651::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ template declaration subclasses.
Defines the clang::SourceLocation class and associated facilities.
static const TemplateArgument & getArgument(const TemplateArgument &A)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
This represents a decl that may have a name.
Sema - This implements semantic analysis and AST building for C.
The JSON file list parser is used to communicate input to InstallAPI.
NormalForm makeCNF(const NormalizedConstraint &Normalized)
llvm::PointerUnion< AtomicConstraint *, FoldExpandedConstraint * > NormalFormConstraint
NormalForm makeDNF(const NormalizedConstraint &Normalized)
bool subsumes(const NormalForm &PDNF, const NormalForm &QCNF, const AtomicSubsumptionEvaluator &E)
const NormalizedConstraint * getNormalizedAssociatedConstraints(Sema &S, NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
@ Other
Other implicit parameter.
bool subsumes(ASTContext &C, const AtomicConstraint &Other) const
AtomicConstraint(Sema &S, const Expr *ConstraintExpr)
std::optional< ArrayRef< TemplateArgumentLoc > > ParameterMapping
bool hasMatchingParameterMapping(ASTContext &C, const AtomicConstraint &Other) const
const Expr * ConstraintExpr
NormalizedConstraint Constraint
bool subsumes(const FoldExpandedConstraint &Other, const AtomicSubsumptionEvaluator &E) const
FoldExpandedConstraint(FoldOperatorKind K, NormalizedConstraint C, const Expr *Pattern)
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
llvm::PointerUnion< AtomicConstraint *, FoldExpandedConstraint *, CompoundConstraint > Constraint
bool isFoldExpanded() const
llvm::PointerIntPair< NormalizedConstraintPair *, 1, CompoundConstraintKind > CompoundConstraint
AtomicConstraint * getAtomicConstraint() const
NormalizedConstraint(NormalizedConstraint &&Other)
NormalizedConstraint(AtomicConstraint *C)
NormalizedConstraint & operator=(const NormalizedConstraint &Other)=delete
NormalizedConstraint & operator=(NormalizedConstraint &&Other)
CompoundConstraintKind getCompoundKind() const
NormalizedConstraint(FoldExpandedConstraint *C)
FoldExpandedConstraint * getFoldExpandedConstraint() const