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) {
138 bool isAtomic()
const {
return llvm::isa<AtomicConstraint *>(Constraint); }
140 return llvm::isa<FoldExpandedConstraint *>(Constraint);
142 bool isCompound()
const {
return llvm::isa<CompoundConstraint>(Constraint); }
144 CompoundConstraintKind getCompoundKind()
const;
154 static std::optional<NormalizedConstraint>
156 static std::optional<NormalizedConstraint>
171 :
Kind(K), Constraint(
std::move(C)), Pattern(Pattern) {};
173 template <
typename AtomicSubsumptionEvaluator>
175 const AtomicSubsumptionEvaluator &
E)
const;
181const NormalizedConstraint *getNormalizedAssociatedConstraints(
182 Sema &S, NamedDecl *ConstrainedDecl,
183 ArrayRef<const Expr *> AssociatedConstraints);
185template <
typename AtomicSubsumptionEvaluator>
187 const AtomicSubsumptionEvaluator &
E) {
192 for (
const auto &Pi : PDNF) {
193 for (
const auto &Qj : QCNF) {
202 if (isa<FoldExpandedConstraint *>(Pia) &&
203 isa<FoldExpandedConstraint *>(Qjb)) {
204 if (cast<FoldExpandedConstraint *>(Pia)->
subsumes(
205 *cast<FoldExpandedConstraint *>(Qjb),
E)) {
209 }
else if (isa<AtomicConstraint *>(Pia) &&
210 isa<AtomicConstraint *>(Qjb)) {
211 if (
E(*cast<AtomicConstraint *>(Pia),
212 *cast<AtomicConstraint *>(Qjb))) {
228template <
typename AtomicSubsumptionEvaluator>
231 const AtomicSubsumptionEvaluator &
E) {
252template <
typename AtomicSubsumptionEvaluator>
253bool FoldExpandedConstraint::subsumes(
255 const AtomicSubsumptionEvaluator &
E)
const {
262 if (
Kind !=
Other.Kind || !AreCompatibleForSubsumption(*
this,
Other))
This file provides AST data structures related to concepts.
Defines the clang::ASTContext interface.
enum clang::sema::@1718::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
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
NormalizedConstraint(NormalizedConstraint &&Other)
NormalizedConstraint(AtomicConstraint *C)
NormalizedConstraint & operator=(const NormalizedConstraint &Other)=delete
NormalizedConstraint & operator=(NormalizedConstraint &&Other)
NormalizedConstraint(FoldExpandedConstraint *C)