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"
37 : ConstraintExpr(ConstraintExpr), ConstraintDecl(ConstraintDecl) {};
41 if (!ParameterMapping != !
Other.ParameterMapping)
43 if (!ParameterMapping)
45 if (ParameterMapping->size() !=
Other.ParameterMapping->size())
48 for (
unsigned I = 0, S = ParameterMapping->size(); I < S; ++I) {
49 llvm::FoldingSetNodeID IDA, IDB;
50 C.getCanonicalTemplateArgument((*ParameterMapping)[I].
getArgument())
52 C.getCanonicalTemplateArgument((*
Other.ParameterMapping)[I].getArgument())
73 if (ConstraintExpr !=
Other.ConstraintExpr)
77 return hasMatchingParameterMapping(C,
Other);
81struct alignas(ConstraintAlignment) FoldExpandedConstraint;
84 llvm::PointerUnion<AtomicConstraint *, FoldExpandedConstraint *>;
126 Constraint(
Other.Constraint) {
127 Other.Constraint =
nullptr;
131 if (&
Other !=
this) {
145 assert(isCompound() &&
"getCompoundKind on a non-compound constraint..");
154 "getAtomicConstraint called on non-atomic constraint.");
159 assert(isFoldExpanded() &&
160 "getFoldExpandedConstraint called on non-fold-expanded constraint.");
165 static std::optional<NormalizedConstraint>
167 static std::optional<NormalizedConstraint>
182 :
Kind(K), Constraint(
std::move(C)), Pattern(Pattern) {};
184 template <
typename AtomicSubsumptionEvaluator>
186 const AtomicSubsumptionEvaluator &
E)
const;
192const NormalizedConstraint *getNormalizedAssociatedConstraints(
193 Sema &S, NamedDecl *ConstrainedDecl,
194 ArrayRef<const Expr *> AssociatedConstraints);
196template <
typename AtomicSubsumptionEvaluator>
198 const AtomicSubsumptionEvaluator &
E) {
203 for (
const auto &Pi : PDNF) {
204 for (
const auto &Qj : QCNF) {
239template <
typename AtomicSubsumptionEvaluator>
242 const AtomicSubsumptionEvaluator &
E) {
263template <
typename AtomicSubsumptionEvaluator>
264bool FoldExpandedConstraint::subsumes(
266 const AtomicSubsumptionEvaluator &
E)
const {
273 if (
Kind !=
Other.Kind || !AreCompatibleForSubsumption(*
this,
Other))
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
enum clang::sema::@1653::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(const Expr *ConstraintExpr, NamedDecl *ConstraintDecl)
NamedDecl * ConstraintDecl
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