diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-10 19:22:46 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-10 19:22:46 +0900 |
commit | 8b02a27fc607ebc54c5a811188b3cea5063564e7 (patch) | |
tree | c1ca7d4acca553301204ebb83383aa87cb59311a /clang/lib/Sema/SemaConcept.cpp | |
parent | 694a772457b2999b7bd68625a16bf0755e95dcdb (diff) | |
parent | 397ac44f623f891d8f05d6673a95984ac0a26671 (diff) | |
download | llvm-users/chapuni/cov/merge/mcdcsort.zip llvm-users/chapuni/cov/merge/mcdcsort.tar.gz llvm-users/chapuni/cov/merge/mcdcsort.tar.bz2 |
Merge branch 'main' into users/chapuni/cov/merge/mcdcsortusers/chapuni/cov/merge/mcdcsort
Diffstat (limited to 'clang/lib/Sema/SemaConcept.cpp')
-rw-r--r-- | clang/lib/Sema/SemaConcept.cpp | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 10f4920..539de00 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -846,7 +846,7 @@ bool Sema::CheckFunctionConstraints(const FunctionDecl *FD, bool ForOverloadResolution) { // Don't check constraints if the function is dependent. Also don't check if // this is a function template specialization, as the call to - // CheckFunctionTemplateConstraints after this will check it + // CheckinstantiatedFunctionTemplateConstraints after this will check it // better. if (FD->isDependentContext() || FD->getTemplatedKind() == @@ -1111,55 +1111,12 @@ bool Sema::EnsureTemplateArgumentListConstraints( return false; } -static bool CheckFunctionConstraintsWithoutInstantiation( - Sema &SemaRef, SourceLocation PointOfInstantiation, - FunctionTemplateDecl *Template, ArrayRef<TemplateArgument> TemplateArgs, - ConstraintSatisfaction &Satisfaction) { - SmallVector<const Expr *, 3> TemplateAC; - Template->getAssociatedConstraints(TemplateAC); - if (TemplateAC.empty()) { - Satisfaction.IsSatisfied = true; - return false; - } - - LocalInstantiationScope Scope(SemaRef); - - FunctionDecl *FD = Template->getTemplatedDecl(); - // Collect the list of template arguments relative to the 'primary' - // template. We need the entire list, since the constraint is completely - // uninstantiated at this point. - - // FIXME: Add TemplateArgs through the 'Innermost' parameter once - // the refactoring of getTemplateInstantiationArgs() relands. - MultiLevelTemplateArgumentList MLTAL; - MLTAL.addOuterTemplateArguments(Template, std::nullopt, /*Final=*/false); - SemaRef.getTemplateInstantiationArgs( - MLTAL, /*D=*/FD, FD, - /*Final=*/false, /*Innermost=*/std::nullopt, /*RelativeToPrimary=*/true, - /*Pattern=*/nullptr, /*ForConstraintInstantiation=*/true); - MLTAL.replaceInnermostTemplateArguments(Template, TemplateArgs); - - Sema::ContextRAII SavedContext(SemaRef, FD); - std::optional<Sema::CXXThisScopeRAII> ThisScope; - if (auto *Method = dyn_cast<CXXMethodDecl>(FD)) - ThisScope.emplace(SemaRef, /*Record=*/Method->getParent(), - /*ThisQuals=*/Method->getMethodQualifiers()); - return SemaRef.CheckConstraintSatisfaction( - Template, TemplateAC, MLTAL, PointOfInstantiation, Satisfaction); -} - -bool Sema::CheckFunctionTemplateConstraints( +bool Sema::CheckInstantiatedFunctionTemplateConstraints( SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef<TemplateArgument> TemplateArgs, ConstraintSatisfaction &Satisfaction) { // In most cases we're not going to have constraints, so check for that first. FunctionTemplateDecl *Template = Decl->getPrimaryTemplate(); - - if (!Template) - return ::CheckFunctionConstraintsWithoutInstantiation( - *this, PointOfInstantiation, Decl->getDescribedFunctionTemplate(), - TemplateArgs, Satisfaction); - // Note - code synthesis context for the constraints check is created // inside CheckConstraintsSatisfaction. SmallVector<const Expr *, 3> TemplateAC; |