29#include "llvm/ADT/DenseMap.h"
30#include "llvm/ADT/PointerUnion.h"
31#include "llvm/ADT/StringExtras.h"
41 const Expr *LHS =
nullptr;
42 const Expr *RHS =
nullptr;
45 LogicalBinOp(
const Expr *
E) {
46 if (
auto *BO = dyn_cast<BinaryOperator>(
E)) {
50 Loc = BO->getExprLoc();
51 }
else if (
auto *OO = dyn_cast<CXXOperatorCallExpr>(
E)) {
53 if (OO->getNumArgs() == 2) {
54 Op = OO->getOperator();
57 Loc = OO->getOperatorLoc();
62 bool isAnd()
const {
return Op == OO_AmpAmp; }
63 bool isOr()
const {
return Op == OO_PipePipe; }
64 explicit operator bool()
const {
return isAnd() || isOr(); }
66 const Expr *getLHS()
const {
return LHS; }
67 const Expr *getRHS()
const {
return RHS; }
71 return recreateBinOp(SemaRef, LHS,
const_cast<Expr *
>(getRHS()));
76 assert((isAnd() || isOr()) &&
"Not the right kind of op?");
93 Token NextToken,
bool *PossibleNonPrimary,
94 bool IsTrailingRequiresClause) {
100 if (LogicalBinOp BO = ConstraintExpression) {
102 PossibleNonPrimary) &&
105 }
else if (
auto *
C = dyn_cast<ExprWithCleanups>(ConstraintExpression))
111 auto CheckForNonPrimary = [&] {
112 if (!PossibleNonPrimary)
115 *PossibleNonPrimary =
126 (NextToken.
is(tok::l_paren) &&
127 (IsTrailingRequiresClause ||
129 isa<UnresolvedLookupExpr>(ConstraintExpression) &&
145 CheckForNonPrimary();
151 diag::err_non_bool_atomic_constraint) <<
Type
153 CheckForNonPrimary();
157 if (PossibleNonPrimary)
158 *PossibleNonPrimary =
false;
163struct SatisfactionStackRAII {
165 bool Inserted =
false;
167 const llvm::FoldingSetNodeID &FSNID)
174 ~SatisfactionStackRAII() {
181template <
typename Constra
intEvaluator>
185 const ConstraintEvaluator &Evaluator);
187template <
typename Constra
intEvaluator>
192 const ConstraintEvaluator &Evaluator) {
193 size_t EffectiveDetailEndIndex = Satisfaction.
Details.size();
203 if (Op == clang::OO_PipePipe && IsLHSSatisfied)
213 if (Op == clang::OO_AmpAmp && !IsLHSSatisfied)
237 if (Op == clang::OO_PipePipe && IsRHSSatisfied) {
238 auto EffectiveDetailEnd = Satisfaction.
Details.begin();
239 std::advance(EffectiveDetailEnd, EffectiveDetailEndIndex);
240 Satisfaction.
Details.erase(EffectiveDetailEnd, Satisfaction.
Details.end());
252template <
typename Constra
intEvaluator>
256 const ConstraintEvaluator &Evaluator) {
257 bool Conjunction = FE->
getOperator() == BinaryOperatorKind::BO_LAnd;
258 size_t EffectiveDetailEndIndex = Satisfaction.
Details.size();
274 std::optional<unsigned> NumExpansions =
275 Evaluator.EvaluateFoldExpandedConstraintSize(FE);
278 for (
unsigned I = 0; I < *NumExpansions; I++) {
281 Satisfaction, Evaluator);
285 if (!Conjunction && IsRHSSatisfied) {
286 auto EffectiveDetailEnd = Satisfaction.
Details.begin();
287 std::advance(EffectiveDetailEnd, EffectiveDetailEndIndex);
288 Satisfaction.
Details.erase(EffectiveDetailEnd,
298 if (Conjunction != IsRHSSatisfied)
304 Satisfaction, Evaluator);
324template <
typename Constra
intEvaluator>
328 const ConstraintEvaluator &Evaluator) {
331 if (LogicalBinOp BO = ConstraintExpr)
333 S, BO.getLHS(), BO.getOp(), BO.getRHS(), Satisfaction, Evaluator);
335 if (
auto *
C = dyn_cast<ExprWithCleanups>(ConstraintExpr)) {
342 if (
auto *FE = dyn_cast<CXXFoldExpr>(ConstraintExpr);
344 (FE->getOperator() == BinaryOperatorKind::BO_LAnd ||
345 FE->getOperator() == BinaryOperatorKind::BO_LOr)) {
351 Evaluator.EvaluateAtomicConstraint(ConstraintExpr);
356 if (!SubstitutedAtomicExpr.
isUsable())
373 unsigned MessageSize = DiagString.size();
374 char *Mem =
new (S.
Context)
char[MessageSize];
375 memcpy(Mem, DiagString.c_str(), MessageSize);
376 Satisfaction.
Details.emplace_back(
378 SubstitutedAtomicExpr.get()->getBeginLoc(),
379 StringRef(Mem, MessageSize)});
380 return SubstitutedAtomicExpr;
387 EvalResult.
Diag = &EvaluationDiags;
390 !EvaluationDiags.empty()) {
394 diag::err_non_constant_constraint_expression)
397 S.
Diag(PDiag.first, PDiag.second);
402 "evaluating bool expression didn't produce int");
405 Satisfaction.
Details.emplace_back(SubstitutedAtomicExpr.
get());
407 return SubstitutedAtomicExpr;
415 for (
const auto &List : MLTAL)
439 struct ConstraintEvaluator {
448 S, Sema::ExpressionEvaluationContext::ConstantEvaluated,
463 llvm::FoldingSetNodeID
ID;
471 SatisfactionStackRAII StackRAII(S, Template,
ID);
475 SubstitutedExpression =
499 unsigned MessageSize = DiagString.size();
500 char *Mem =
new (S.
Context)
char[MessageSize];
501 memcpy(Mem, DiagString.c_str(), MessageSize);
502 Satisfaction.
Details.emplace_back(
504 SubstDiag.first, StringRef(Mem, MessageSize)});
526 CK_LValueToRValue, SubstitutedExpression.
get(),
529 return SubstitutedExpression;
532 std::optional<unsigned>
533 EvaluateFoldExpandedConstraintSize(
const CXXFoldExpr *FE)
const {
538 assert(!Unexpanded.empty() &&
"Pack expansion without parameter packs?");
540 bool RetainExpansion =
false;
542 NumExpansions = OrigNumExpansions;
545 MLTAL, Expand, RetainExpansion, NumExpansions) ||
546 !Expand || RetainExpansion)
549 if (NumExpansions && S.
getLangOpts().BracketDepth < NumExpansions) {
551 clang::diag::err_fold_expression_limit_exceeded)
557 return NumExpansions;
562 S, ConstraintExpr, Satisfaction,
563 ConstraintEvaluator{S, Template, TemplateNameLoc, MLTAL, Satisfaction});
571 if (ConstraintExprs.empty()) {
588 const_cast<NamedDecl *
>(Template), TemplateArgs, TemplateIDRange);
592 for (
const Expr *ConstraintExpr : ConstraintExprs) {
594 S, Template, TemplateIDRange.
getBegin(), TemplateArgsLists,
595 ConstraintExpr, Satisfaction);
599 Converted.push_back(Res.
get());
603 Converted.append(ConstraintExprs.size() - Converted.size(),
nullptr);
619 if (ConstraintExprs.empty()) {
624 return ::CheckConstraintSatisfaction(
625 *
this,
nullptr, ConstraintExprs, ConvertedConstraints,
626 TemplateArgsLists, TemplateIDRange, OutSatisfaction);
640 for (
auto List : TemplateArgsLists)
641 FlattenedArgs.insert(FlattenedArgs.end(), List.Args.begin(),
644 llvm::FoldingSetNodeID ID;
647 if (
auto *Cached = SatisfactionCache.FindNodeOrInsertPos(ID, InsertPos)) {
648 OutSatisfaction = *Cached;
653 std::make_unique<ConstraintSatisfaction>(Template, FlattenedArgs);
655 ConvertedConstraints, TemplateArgsLists,
656 TemplateIDRange, *Satisfaction)) {
657 OutSatisfaction = *Satisfaction;
661 if (
auto *Cached = SatisfactionCache.FindNodeOrInsertPos(ID, InsertPos)) {
670 OutSatisfaction = *Cached;
675 OutSatisfaction = *Satisfaction;
679 SatisfactionCache.InsertNode(Satisfaction.release());
686 struct ConstraintEvaluator {
692 std::optional<unsigned>
693 EvaluateFoldExpandedConstraintSize(
const CXXFoldExpr *FE)
const {
699 ConstraintEvaluator{*
this})
703bool Sema::addInstantiatedCapturesToScope(
707 const auto *LambdaClass = cast<CXXMethodDecl>(
Function)->getParent();
708 const auto *LambdaPattern = cast<CXXMethodDecl>(PatternDecl)->getParent();
710 unsigned Instantiated = 0;
712 auto AddSingleCapture = [&](
const ValueDecl *CapturedPattern,
714 ValueDecl *CapturedVar = LambdaClass->getCapture(Index)->getCapturedVar();
716 Scope.InstantiatedLocal(CapturedPattern, CapturedVar);
719 for (
const LambdaCapture &CapturePattern : LambdaPattern->captures()) {
720 if (!CapturePattern.capturesVariable()) {
724 const ValueDecl *CapturedPattern = CapturePattern.getCapturedVar();
726 AddSingleCapture(CapturedPattern, Instantiated++);
728 Scope.MakeInstantiatedLocalArgPack(CapturedPattern);
729 std::optional<unsigned> NumArgumentsInExpansion =
731 if (!NumArgumentsInExpansion)
733 for (
unsigned Arg = 0; Arg < *NumArgumentsInExpansion; ++Arg)
734 AddSingleCapture(CapturedPattern, Instantiated++);
740bool Sema::SetupConstraintScope(
746 InstantiatingTemplate Inst(
751 if (Inst.isInvalid())
762 if (addInstantiatedParametersToScope(
775 while (FromMemTempl->getInstantiatedFromMemberTemplate())
776 FromMemTempl = FromMemTempl->getInstantiatedFromMemberTemplate();
777 if (addInstantiatedParametersToScope(FD, FromMemTempl->getTemplatedDecl(),
792 InstantiatingTemplate Inst(
797 if (Inst.isInvalid())
802 if (addInstantiatedParametersToScope(FD, InstantiatedFrom,
Scope, MLTAL))
811std::optional<MultiLevelTemplateArgumentList>
812Sema::SetupConstraintCheckingTemplateArgumentsAndScope(
826 if (SetupConstraintScope(FD, TemplateArgs, MLTAL,
Scope))
835 bool ForOverloadResolution) {
854 if (
const auto *MD = dyn_cast<CXXConversionDecl>(FD);
857 Satisfaction, UsageLoc,
871 std::optional<MultiLevelTemplateArgumentList> MLTAL =
872 SetupConstraintCheckingTemplateArgumentsAndScope(
880 if (
auto *Method = dyn_cast<CXXMethodDecl>(FD)) {
881 ThisQuals = Method->getMethodQualifiers();
888 ForOverloadResolution);
902 bool SkipForSpecialization =
false) {
908 true, SkipForSpecialization);
913 class AdjustConstraintDepth :
public TreeTransform<AdjustConstraintDepth> {
914 unsigned TemplateDepth = 0;
917 AdjustConstraintDepth(
Sema &SemaRef,
unsigned TemplateDepth)
918 : inherited(SemaRef), TemplateDepth(TemplateDepth) {}
920 using inherited::TransformTemplateTypeParmType;
927 NewTTPDecl = cast_or_null<TemplateTypeParmDecl>(
930 QualType Result = getSema().Context.getTemplateTypeParmType(
931 T->getDepth() + TemplateDepth,
T->getIndex(),
T->isParameterPack(),
942 const Expr *ConstrExpr) {
971 std::optional<Sema::CXXThisScopeRAII> ThisScope;
980 std::optional<Sema::ContextRAII> ContextScope;
981 if (
auto *RD = dyn_cast<CXXRecordDecl>(DeclInfo.
getDeclContext())) {
983 ContextScope.emplace(S,
const_cast<DeclContext *
>(cast<DeclContext>(RD)),
990 return SubstConstr.
get();
994 const Expr *OldConstr,
996 const Expr *NewConstr) {
997 if (OldConstr == NewConstr)
1002 if (
const Expr *SubstConstr =
1005 OldConstr = SubstConstr;
1008 if (
const Expr *SubstConstr =
1011 NewConstr = SubstConstr;
1016 llvm::FoldingSetNodeID ID1, ID2;
1029 "Non-function templates don't need to be checked");
1035 for (
const Expr *Constraint : ACs)
1050 TemplateIDRange, Satisfaction))
1055 TemplateArgString =
" ";
1061 diag::err_template_arg_list_constraints_not_satisfied)
1063 << TemplateArgString << TemplateIDRange;
1080 if (TemplateAC.empty()) {
1090 std::optional<MultiLevelTemplateArgumentList> MLTAL =
1091 SetupConstraintCheckingTemplateArgumentsAndScope(
Decl, TemplateArgs,
1099 if (
auto *Method = dyn_cast<CXXMethodDecl>(
Decl)) {
1100 ThisQuals = Method->getMethodQualifiers();
1101 Record = Method->getParent();
1110 PointOfInstantiation, Satisfaction);
1117 &&
"Diagnose() can only be used on an unsatisfied requirement");
1120 llvm_unreachable(
"Diagnosing a dependent requirement");
1124 if (!SubstDiag->DiagMessage.empty())
1125 S.
Diag(SubstDiag->DiagLoc,
1126 diag::note_expr_requirement_expr_substitution_error)
1127 << (
int)
First << SubstDiag->SubstitutedEntity
1128 << SubstDiag->DiagMessage;
1130 S.
Diag(SubstDiag->DiagLoc,
1131 diag::note_expr_requirement_expr_unknown_substitution_error)
1132 << (
int)
First << SubstDiag->SubstitutedEntity;
1137 diag::note_expr_requirement_noexcept_not_met)
1143 if (!SubstDiag->DiagMessage.empty())
1144 S.
Diag(SubstDiag->DiagLoc,
1145 diag::note_expr_requirement_type_requirement_substitution_error)
1146 << (
int)
First << SubstDiag->SubstitutedEntity
1147 << SubstDiag->DiagMessage;
1149 S.
Diag(SubstDiag->DiagLoc,
1150 diag::note_expr_requirement_type_requirement_unknown_substitution_error)
1151 << (
int)
First << SubstDiag->SubstitutedEntity;
1162 diag::note_expr_requirement_constraints_not_satisfied_simple)
1167 diag::note_expr_requirement_constraints_not_satisfied)
1168 << (
int)
First << ConstraintExpr;
1174 llvm_unreachable(
"We checked this above");
1182 &&
"Diagnose() can only be used on an unsatisfied requirement");
1185 llvm_unreachable(
"Diagnosing a dependent requirement");
1189 if (!SubstDiag->DiagMessage.empty())
1190 S.
Diag(SubstDiag->DiagLoc,
1191 diag::note_type_requirement_substitution_error) << (
int)
First
1192 << SubstDiag->SubstitutedEntity << SubstDiag->DiagMessage;
1194 S.
Diag(SubstDiag->DiagLoc,
1195 diag::note_type_requirement_unknown_substitution_error)
1196 << (
int)
First << SubstDiag->SubstitutedEntity;
1200 llvm_unreachable(
"Unknown satisfaction status");
1211 using SubstitutionDiagnostic = std::pair<SourceLocation, StringRef>;
1213 if (
auto *SubstDiag =
Record.dyn_cast<SubstitutionDiagnostic *>())
1214 S.
Diag(SubstDiag->first, diag::note_nested_requirement_substitution_error)
1216 << SubstDiag->second;
1229 switch (BO->getOpcode()) {
1241 BO->getLHS()->EvaluateKnownConstInt(S.
Context).getBoolValue();
1252 BO->getRHS()->EvaluateKnownConstInt(S.
Context).getBoolValue();
1264 if (BO->getLHS()->getType()->isIntegerType() &&
1265 BO->getRHS()->getType()->isIntegerType()) {
1268 BO->getLHS()->EvaluateAsInt(SimplifiedLHS, S.
Context,
1271 BO->getRHS()->EvaluateAsInt(SimplifiedRHS, S.
Context,
1274 if (!SimplifiedLHS.
Diag && ! SimplifiedRHS.
Diag) {
1276 diag::note_atomic_constraint_evaluated_to_false_elaborated)
1289 }
else if (
auto *CSE = dyn_cast<ConceptSpecializationExpr>(SubstExpr)) {
1290 if (CSE->getTemplateArgsAsWritten()->NumTemplateArgs == 1) {
1292 CSE->getSourceRange().getBegin(),
1294 note_single_arg_concept_specialization_constraint_evaluated_to_false)
1296 << CSE->getTemplateArgsAsWritten()->arguments()[0].getArgument()
1297 << CSE->getNamedConcept();
1300 diag::note_concept_specialization_constraint_evaluated_to_false)
1301 << (
int)
First << CSE;
1305 }
else if (
auto *RE = dyn_cast<RequiresExpr>(SubstExpr)) {
1308 if (!Req->isDependent() && !Req->isSatisfied()) {
1309 if (
auto *
E = dyn_cast<concepts::ExprRequirement>(Req))
1311 else if (
auto *
T = dyn_cast<concepts::TypeRequirement>(Req))
1315 S, cast<concepts::NestedRequirement>(Req),
First);
1319 }
else if (
auto *TTE = dyn_cast<TypeTraitExpr>(SubstExpr);
1320 TTE && TTE->getTrait() == clang::TypeTrait::BTT_IsDeducible) {
1321 assert(TTE->getNumArgs() == 2);
1323 diag::note_is_deducible_constraint_evaluated_to_false)
1324 << TTE->getArg(0)->getType() << TTE->getArg(1)->getType();
1329 diag::note_atomic_constraint_evaluated_to_false)
1333template <
typename SubstitutionDiagnostic>
1335 Sema &S,
const llvm::PointerUnion<Expr *, SubstitutionDiagnostic *> &
Record,
1336 bool First =
true) {
1337 if (
auto *
Diag =
Record.template dyn_cast<SubstitutionDiagnostic *>()) {
1338 S.
Diag(
Diag->first, diag::note_substituted_constraint_expr_is_ill_formed)
1351 "Attempted to diagnose a satisfied constraint");
1362 "Attempted to diagnose a satisfied constraint");
1363 for (
auto &
Record : Satisfaction) {
1377 auto CacheEntry = NormalizationCache.find(ConstrainedDecl);
1378 if (CacheEntry == NormalizationCache.end()) {
1380 NormalizedConstraint::fromConstraintExprs(*
this, ConstrainedDecl,
1381 AssociatedConstraints);
1384 .try_emplace(ConstrainedDecl,
1387 std::move(*Normalized))
1391 return CacheEntry->second;
1398 AssociatedConstraints);
1426 if (!
Atomic.ParameterMapping) {
1427 llvm::SmallBitVector OccurringIndices(TemplateParams->
size());
1429 0, OccurringIndices);
1432 for (
unsigned I = 0, J = 0,
C = TemplateParams->
size(); I !=
C; ++I)
1433 if (OccurringIndices[I])
1434 new (&(TempArgs)[J++])
1436 TemplateParams->
begin()[I],
1446 ? ArgsAsWritten->
arguments()[I].getLocation()
1448 Atomic.ParameterMapping.emplace(TempArgs, OccurringIndices.count());
1453 : ArgsAsWritten->
arguments().front().getSourceRange().getBegin();
1457 : ArgsAsWritten->
arguments().front().getSourceRange().getEnd();
1461 {InstLocBegin, InstLocEnd});
1462 if (Inst.isInvalid())
1471 Atomic.ParameterMapping.emplace(TempArgs, SubstArgs.
size());
1498 if (
Other.isAtomic()) {
1500 }
else if (
Other.isFoldExpanded()) {
1502 Other.getFoldExpandedConstraint()->Kind,
1504 Other.getFoldExpandedConstraint()->Pattern);
1510 Other.getCompoundKind());
1515 assert(
isCompound() &&
"getLHS called on a non-compound constraint.");
1520 assert(
isCompound() &&
"getRHS called on a non-compound constraint.");
1524std::optional<NormalizedConstraint>
1527 assert(
E.size() != 0);
1528 auto Conjunction = fromConstraintExpr(S,
D,
E[0]);
1530 return std::nullopt;
1531 for (
unsigned I = 1; I <
E.size(); ++I) {
1532 auto Next = fromConstraintExpr(S,
D,
E[I]);
1534 return std::nullopt;
1541std::optional<NormalizedConstraint>
1543 assert(
E !=
nullptr);
1556 if (LogicalBinOp BO =
E) {
1557 auto LHS = fromConstraintExpr(S,
D, BO.getLHS());
1559 return std::nullopt;
1560 auto RHS = fromConstraintExpr(S,
D, BO.getRHS());
1562 return std::nullopt;
1566 }
else if (
auto *CSE = dyn_cast<const ConceptSpecializationExpr>(
E)) {
1570 S, CSE->getExprLoc(),
1573 if (Inst.isInvalid())
1574 return std::nullopt;
1588 return std::nullopt;
1591 std::optional<NormalizedConstraint> New;
1592 New.emplace(S.
Context, *SubNF);
1595 return std::nullopt;
1598 }
else if (
auto *FE = dyn_cast<const CXXFoldExpr>(
E);
1600 (FE->getOperator() == BinaryOperatorKind::BO_LAnd ||
1601 FE->getOperator() == BinaryOperatorKind::BO_LOr)) {
1606 FE->getOperator() == BinaryOperatorKind::BO_LAnd
1610 if (FE->getInit()) {
1611 auto LHS = fromConstraintExpr(S,
D, FE->getLHS());
1612 auto RHS = fromConstraintExpr(S,
D, FE->getRHS());
1614 return std::nullopt;
1616 if (FE->isRightFold())
1618 Kind, std::move(*RHS), FE->getPattern()}};
1621 Kind, std::move(*LHS), FE->getPattern()}};
1624 S.
Context, std::move(*LHS), std::move(*RHS),
1628 auto Sub = fromConstraintExpr(S,
D, FE->getPattern());
1630 return std::nullopt;
1632 Kind, std::move(*Sub), FE->getPattern()}};
1654 if (it != BPacks.end())
1670 LCNF.reserve(LCNF.size() + RCNF.size());
1671 while (!RCNF.empty())
1672 LCNF.push_back(RCNF.pop_back_val());
1678 Res.reserve(LCNF.size() * RCNF.size());
1679 for (
auto &LDisjunction : LCNF)
1680 for (
auto &RDisjunction : RCNF) {
1681 NormalForm::value_type Combined;
1682 Combined.reserve(LDisjunction.size() + RDisjunction.size());
1683 std::copy(LDisjunction.begin(), LDisjunction.end(),
1684 std::back_inserter(Combined));
1685 std::copy(RDisjunction.begin(), RDisjunction.end(),
1686 std::back_inserter(Combined));
1687 Res.emplace_back(Combined);
1702 LDNF.reserve(LDNF.size() + RDNF.size());
1703 while (!RDNF.empty())
1704 LDNF.push_back(RDNF.pop_back_val());
1710 Res.reserve(LDNF.size() * RDNF.size());
1711 for (
auto &LConjunction : LDNF) {
1712 for (
auto &RConjunction : RDNF) {
1713 NormalForm::value_type Combined;
1714 Combined.reserve(LConjunction.size() + RConjunction.size());
1715 std::copy(LConjunction.begin(), LConjunction.end(),
1716 std::back_inserter(Combined));
1717 std::copy(RConjunction.begin(), RConjunction.end(),
1718 std::back_inserter(Combined));
1719 Res.emplace_back(Combined);
1730 if (
const auto *FD1 = dyn_cast<FunctionDecl>(D1)) {
1736 const auto *FD2 = dyn_cast<FunctionDecl>(D2);
1737 (void)IsExpectedEntity;
1740 assert(IsExpectedEntity(FD1) && FD2 && IsExpectedEntity(FD2) &&
1741 "use non-instantiated function declaration for constraints partial "
1755 std::pair<NamedDecl *, NamedDecl *> Key{D1, D2};
1756 auto CacheEntry = SubsumptionCache.find(Key);
1757 if (CacheEntry != SubsumptionCache.end()) {
1758 Result = CacheEntry->second;
1765 for (
size_t I = 0; I != AC1.size() && I != AC2.size(); ++I) {
1766 if (Depth2 > Depth1) {
1767 AC1[I] = AdjustConstraintDepth(*
this, Depth2 - Depth1)
1768 .TransformExpr(
const_cast<Expr *
>(AC1[I]))
1770 }
else if (Depth1 > Depth2) {
1771 AC2[I] = AdjustConstraintDepth(*
this, Depth1 - Depth2)
1772 .TransformExpr(
const_cast<Expr *
>(AC2[I]))
1778 *
this, D1, AC1, D2, AC2,
Result,
1783 SubsumptionCache.try_emplace(Key,
Result);
1793 if (AC1.empty() || AC2.empty())
1796 auto NormalExprEvaluator =
1801 const Expr *AmbiguousAtomic1 =
nullptr, *AmbiguousAtomic2 =
nullptr;
1802 auto IdenticalExprEvaluator =
1812 llvm::FoldingSetNodeID IDA, IDB;
1814 EB->Profile(IDB,
Context,
true);
1818 AmbiguousAtomic1 = EA;
1819 AmbiguousAtomic2 = EB;
1838 bool Is1AtLeastAs2Normally =
1840 bool Is2AtLeastAs1Normally =
1842 bool Is1AtLeastAs2 =
clang::subsumes(DNF1, CNF2, IdenticalExprEvaluator);
1843 bool Is2AtLeastAs1 =
clang::subsumes(DNF2, CNF1, IdenticalExprEvaluator);
1844 if (Is1AtLeastAs2 == Is1AtLeastAs2Normally &&
1845 Is2AtLeastAs1 == Is2AtLeastAs1Normally)
1851 assert(AmbiguousAtomic1 && AmbiguousAtomic2);
1853 Diag(AmbiguousAtomic1->
getBeginLoc(), diag::note_ambiguous_atomic_constraints)
1855 Diag(AmbiguousAtomic2->getBeginLoc(),
1856 diag::note_ambiguous_atomic_constraints_similar_expression)
1857 << AmbiguousAtomic2->getSourceRange();
1865 Requirement(IsSimple ? RK_Simple : RK_Compound, Status == SS_Dependent,
1866 Status == SS_Dependent &&
1867 (
E->containsUnexpandedParameterPack() ||
1868 Req.containsUnexpandedParameterPack()),
1869 Status == SS_Satisfied),
Value(
E), NoexceptLoc(NoexceptLoc),
1870 TypeReq(Req), SubstitutedConstraintExpr(SubstitutedConstraintExpr),
1873 "Simple requirement must not have a return type requirement or a "
1874 "noexcept specification");
1876 (SubstitutedConstraintExpr !=
nullptr));
1882 Requirement(IsSimple ? RK_Simple : RK_Compound, Req.isDependent(),
1883 Req.containsUnexpandedParameterPack(),
false),
1884 Value(ExprSubstDiag), NoexceptLoc(NoexceptLoc), TypeReq(Req),
1885 Status(SS_ExprSubstitutionFailure) {
1887 "Simple requirement must not have a return type requirement or a "
1888 "noexcept specification");
1893 TypeConstraintInfo(TPL,
false) {
1894 assert(TPL->
size() == 1);
1896 cast<TemplateTypeParmDecl>(TPL->
getParam(0))->getTypeConstraint();
1898 "TPL must have a template type parameter with a type constraint");
1902 Constraint->getTemplateArgsAsWritten() &&
1904 Constraint->getTemplateArgsAsWritten()->arguments().drop_front(1));
1905 TypeConstraintInfo.setInt(
Dependent ?
true :
false);
1916 Status(
T->getType()->isInstantiationDependentType() ?
SS_Dependent
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines Expressions and AST nodes for C++2a concepts.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
llvm::MachO::Record Record
Defines and computes precedence levels for binary/ternary operators.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
static bool CheckConstraintSatisfaction(Sema &S, const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, llvm::SmallVectorImpl< Expr * > &Converted, const MultiLevelTemplateArgumentList &TemplateArgsLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
static const Expr * SubstituteConstraintExpressionWithoutSatisfaction(Sema &S, const Sema::TemplateCompareNewDeclInfo &DeclInfo, const Expr *ConstrExpr)
static ExprResult calculateConstraintSatisfaction(Sema &S, const Expr *ConstraintExpr, ConstraintSatisfaction &Satisfaction, const ConstraintEvaluator &Evaluator)
static bool DiagRecursiveConstraintEval(Sema &S, llvm::FoldingSetNodeID &ID, const NamedDecl *Templ, const Expr *E, const MultiLevelTemplateArgumentList &MLTAL)
static void diagnoseWellFormedUnsatisfiedConstraintExpr(Sema &S, Expr *SubstExpr, bool First=true)
static void diagnoseUnsatisfiedRequirement(Sema &S, concepts::ExprRequirement *Req, bool First)
static bool substituteParameterMappings(Sema &S, NormalizedConstraint &N, ConceptDecl *Concept, const MultiLevelTemplateArgumentList &MLTAL, const ASTTemplateArgumentListInfo *ArgsAsWritten)
static void diagnoseUnsatisfiedConstraintExpr(Sema &S, const llvm::PointerUnion< Expr *, SubstitutionDiagnostic * > &Record, bool First=true)
static unsigned CalculateTemplateDepthForConstraints(Sema &S, const NamedDecl *ND, bool SkipForSpecialization=false)
static bool isInvalid(LocType Loc, bool *Invalid)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
SourceLocation getBeginLoc() const LLVM_READONLY
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
StringRef getOpcodeStr() const
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
Represents a C++ conversion function within a class.
Represents a folding of a pack over an operator.
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getInit() const
Get the operand that doesn't contain a pack, for a binary fold.
std::optional< unsigned > getNumExpansions() const
SourceLocation getEllipsisLoc() const
bool isLeftFold() const
Does this produce a left-associated sequence of operators?
bool isRightFold() const
Does this produce a right-associated sequence of operators?
Expr * getPattern() const
Get the pattern, that is, the operand that contains an unexpanded pack.
BinaryOperatorKind getOperator() const
Represents a C++ struct/union/class.
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
Represents the specialization of a concept - evaluates to a prvalue of type bool.
SourceLocation getBeginLoc() const LLVM_READONLY
ArrayRef< TemplateArgument > getTemplateArguments() const
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
const ASTConstraintSatisfaction & getSatisfaction() const
Get elaborated satisfaction info about the template arguments' satisfaction of the named concept.
ConceptDecl * getNamedConcept() const
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
std::pair< SourceLocation, StringRef > SubstitutionDiagnostic
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &C)
llvm::SmallVector< Detail, 4 > Details
The substituted constraint expr, if the template arguments could be substituted into them,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isTransparentContext() const
isTransparentContext - Determines whether this context is a "transparent" context,...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getNonTransparentContext()
Decl - This represents one declaration (or definition), e.g.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
bool isParameterPack() const
Whether this declaration is a parameter pack.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
bool isInvalidDecl() const
SourceLocation getLocation() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
RAII object that enters a new expression evaluation context.
This represents one expression.
@ SE_NoSideEffects
Strictly evaluate the expression.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, ConstantExprKind Kind=ConstantExprKind::Normal) const
Evaluate an expression that is required to be a constant expression.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Represents difference between two FPOptions values.
Represents a function declaration or definition.
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
ArrayRef< ParmVarDecl * > parameters() const
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
bool isTemplateInstantiation() const
Determines if the given function was instantiated from a function template.
TemplatedKind
The kind of templated function a FunctionDecl can be.
@ TK_MemberSpecialization
@ TK_DependentNonTemplate
@ TK_FunctionTemplateSpecialization
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
FunctionDecl * getInstantiatedFromDecl() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
const TypeClass * getTypePtr() const
Describes the capture of a variable or of this, or of a C++1y init-capture.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
void InstantiatedLocal(const Decl *D, Decl *Inst)
Data structure that captures multiple levels of template argument lists for use in template instantia...
const ArgList & getInnermost() const
Retrieve the innermost template argument list.
unsigned getNumLevels() const
Determine the number of levels in this template argument list.
unsigned getNumSubstitutedLevels() const
Determine the number of substituted levels in this template argument list.
const ArgList & getOutermost() const
Retrieve the outermost template argument list.
bool isAnyArgInstantiationDependent() const
This represents a decl that may have a name.
void EmitToString(DiagnosticsEngine &Diags, SmallVectorImpl< char > &Buf) const
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
Scope - A scope is a transient data structure that is used while parsing the program.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
RAII object used to change the argument pack substitution index within a Sema object.
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
SourceLocation getLocation() const
bool ContainsDecl(const NamedDecl *ND) const
const DeclContext * getDeclContext() const
const NamedDecl * getDecl() const
const DeclContext * getLexicalDeclContext() const
Sema - This implements semantic analysis and AST building for C.
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, std::optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
bool ConstraintExpressionDependsOnEnclosingTemplate(const FunctionDecl *Friend, unsigned TemplateDepth, const Expr *Constraint)
DiagnosticsEngine & getDiagnostics() const
ExprResult SubstConstraintExprWithoutSatisfaction(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
bool FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD)
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, const MultiLevelTemplateArgumentList &TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
const LangOptions & getLangOpts() const
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const TemplateCompareNewDeclInfo &New, const Expr *NewConstr)
sema::FunctionScopeInfo * getCurFunction() const
std::optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation(), bool ForOverloadResolution=false)
Check whether the given function decl's trailing requires clause is satisfied, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef< const Expr * > AC1, NamedDecl *D2, MutableArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
void PushSatisfactionStackEntry(const NamedDecl *D, const llvm::FoldingSetNodeID &ID)
void PopSatisfactionStackEntry()
ExprResult SubstConstraintExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
bool SatisfactionStackContains(const NamedDecl *D, const llvm::FoldingSetNodeID &ID) const
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument > > Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
SourceLocation getBeginLoc() const LLVM_READONLY
A convenient class for passing around template argument information.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
Location wrapper for a TemplateArgument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
void getAssociatedConstraints(llvm::SmallVectorImpl< const Expr * > &AC) const
Get the total constraint-expression associated with this template, including constraint-expressions d...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static bool anyInstantiationDependentTemplateArguments(ArrayRef< TemplateArgumentLoc > Args)
Declaration of a template type parameter.
Wrapper for template type parameters.
Token - This structure provides full information about a lexed token.
bool is(tok::TokenKind K) const
is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....
tok::TokenKind getKind() const
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
A container of type source information.
SourceLocation getNameLoc() const
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFunctionType() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
ReturnTypeRequirement()
No return type requirement was specified.
bool isTypeConstraint() const
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
A requires-expression requirement which queries the validity and properties of an expression ('simple...
SubstitutionDiagnostic * getExprSubstitutionDiagnostic() const
ConceptSpecializationExpr * getReturnTypeRequirementSubstitutedConstraintExpr() const
@ SS_ConstraintsNotSatisfied
@ SS_TypeRequirementSubstitutionFailure
@ SS_ExprSubstitutionFailure
const ReturnTypeRequirement & getReturnTypeRequirement() const
SatisfactionStatus getSatisfactionStatus() const
SourceLocation getNoexceptLoc() const
ExprRequirement(Expr *E, bool IsSimple, SourceLocation NoexceptLoc, ReturnTypeRequirement Req, SatisfactionStatus Status, ConceptSpecializationExpr *SubstitutedConstraintExpr=nullptr)
Construct a compound requirement.
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
const ASTConstraintSatisfaction & getConstraintSatisfaction() const
StringRef getInvalidConstraintEntity()
A static requirement that can be used in a requires-expression to check properties of types and expre...
bool containsUnexpandedParameterPack() const
A requires-expression requirement which queries the existence of a type name or type template special...
SubstitutionDiagnostic * getSubstitutionDiagnostic() const
SatisfactionStatus getSatisfactionStatus() const
TypeRequirement(TypeSourceInfo *T)
Construct a type requirement from a type.
Provides information about an attempted template argument deduction, whose success or failure was des...
void takeSFINAEDiagnostic(PartialDiagnosticAt &PD)
Take ownership of the SFINAE diagnostic.
bool Sub(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
NormalForm makeCNF(const NormalizedConstraint &Normalized)
NormalForm makeDNF(const NormalizedConstraint &Normalized)
@ OK_Ordinary
An ordinary object is located at an address in memory.
bool subsumes(const NormalForm &PDNF, const NormalForm &QCNF, const AtomicSubsumptionEvaluator &E)
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
const NormalizedConstraint * getNormalizedAssociatedConstraints(Sema &S, NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
std::pair< unsigned, unsigned > getDepthAndIndex(NamedDecl *ND)
Retrieve the depth and index of a template parameter.
bool isLambdaConversionOperator(CXXConversionDecl *C)
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
const FunctionProtoType * T
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
@ Other
Other implicit parameter.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
SourceLocation getLAngleLoc() const
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
SourceLocation getRAngleLoc() const
bool subsumes(ASTContext &C, const AtomicConstraint &Other) const
bool hasMatchingParameterMapping(ASTContext &C, const AtomicConstraint &Other) const
const Expr * ConstraintExpr
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
NormalizedConstraint Constraint
static bool AreCompatibleForSubsumption(const FoldExpandedConstraint &A, const FoldExpandedConstraint &B)
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
llvm::PointerUnion< AtomicConstraint *, FoldExpandedConstraint *, CompoundConstraint > Constraint
bool isFoldExpanded() const
NormalizedConstraint & getRHS() const
llvm::PointerIntPair< NormalizedConstraintPair *, 1, CompoundConstraintKind > CompoundConstraint
AtomicConstraint * getAtomicConstraint() const
NormalizedConstraint(AtomicConstraint *C)
CompoundConstraintKind getCompoundKind() const
NormalizedConstraint & getLHS() const
FoldExpandedConstraint * getFoldExpandedConstraint() const
A stack object to be created when performing template instantiation.
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.