Skip to content

Commit c304c74

Browse files
committed
[FOLD] address some review feedback
1 parent d75a019 commit c304c74

File tree

3 files changed

+17
-41
lines changed

3 files changed

+17
-41
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,11 +1061,7 @@ bool Sema::FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD) {
10611061
SmallVector<const Expr *, 3> ACs;
10621062
FTD->getAssociatedConstraints(ACs);
10631063

1064-
#if 0
1065-
unsigned OldTemplateDepth = CalculateTemplateDepthForConstraints(*this, FD);
1066-
#else
10671064
unsigned OldTemplateDepth = FTD->getTemplateParameters()->getDepth();
1068-
#endif
10691065
for (const Expr *Constraint : ACs)
10701066
if (ConstraintExpressionDependsOnEnclosingTemplate(FD, OldTemplateDepth,
10711067
Constraint))

clang/lib/Sema/SemaTemplateDeductionGuide.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ struct ConvertConstructorToDeductionGuideTransform {
317317
}
318318

319319
if (NestedPattern)
320-
OuterInstantiationArgs = SemaRef.getTemplateInstantiationArgs(
321-
/*D=*/nullptr, Template->getDeclContext());
320+
OuterInstantiationArgs = SemaRef.getTemplateInstantiationArgs(Template);
322321
}
323322

324323
Sema &SemaRef;
@@ -833,7 +832,6 @@ buildAssociatedConstraints(Sema &SemaRef, FunctionTemplateDecl *F,
833832
/*Innermost=*/InnerArgsForBuildingRC,
834833
/*RelativeToPrimary=*/true,
835834
/*ForConstraintInstantiation=*/true);
836-
;
837835
ArgsForBuildingRC.setKind(clang::TemplateSubstitutionKind::Rewrite);
838836

839837
ExprResult E = SemaRef.SubstExpr(RC, ArgsForBuildingRC);

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,43 +1653,25 @@ namespace {
16531653

16541654
ExprResult RebuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
16551655
LambdaScopeInfo *LSI) {
1656-
#if 1
16571656
CXXMethodDecl *MD = LSI->CallOperator;
1658-
// if (MD->getParentFunctionOrMethod()) {
1659-
if (true) {
1660-
#if 0
1661-
NamedDecl *Pattern = MD;
1662-
std::optional<ArrayRef<TemplateArgument>> Innermost;
1663-
if (FunctionTemplateDecl *FTD = MD->getDescribedFunctionTemplate()) {
1664-
Pattern = FTD;
1665-
Innermost = FTD->getInjectedTemplateArgs();
1666-
}
1667-
MultiLevelTemplateArgumentList MLTAL =
1668-
SemaRef.getTemplateInstantiationArgs(Pattern, Pattern->getLexicalDeclContext(),
1669-
/*Final=*/false, Innermost,
1670-
/*RelativeToPrimary=*/true);
1671-
#endif
1672-
;
1673-
for (ParmVarDecl *PVD : MD->parameters()) {
1674-
assert(PVD && "null in a parameter list");
1675-
if (!PVD->hasDefaultArg())
1676-
continue;
1677-
Expr *UninstExpr = PVD->getUninstantiatedDefaultArg();
1678-
// FIXME: Obtain the source location for the '=' token.
1679-
SourceLocation EqualLoc = UninstExpr->getBeginLoc();
1680-
if (SemaRef.SubstDefaultArgument(EqualLoc, PVD, TemplateArgs)) {
1681-
// If substitution fails, the default argument is set to a
1682-
// RecoveryExpr that wraps the uninstantiated default argument so
1683-
// that downstream diagnostics are omitted.
1684-
ExprResult ErrorResult = SemaRef.CreateRecoveryExpr(
1685-
UninstExpr->getBeginLoc(), UninstExpr->getEndLoc(),
1686-
{UninstExpr}, UninstExpr->getType());
1687-
if (ErrorResult.isUsable())
1688-
PVD->setDefaultArg(ErrorResult.get());
1689-
}
1657+
for (ParmVarDecl *PVD : MD->parameters()) {
1658+
assert(PVD && "null in a parameter list");
1659+
if (!PVD->hasDefaultArg())
1660+
continue;
1661+
Expr *UninstExpr = PVD->getUninstantiatedDefaultArg();
1662+
// FIXME: Obtain the source location for the '=' token.
1663+
SourceLocation EqualLoc = UninstExpr->getBeginLoc();
1664+
if (SemaRef.SubstDefaultArgument(EqualLoc, PVD, TemplateArgs)) {
1665+
// If substitution fails, the default argument is set to a
1666+
// RecoveryExpr that wraps the uninstantiated default argument so
1667+
// that downstream diagnostics are omitted.
1668+
ExprResult ErrorResult = SemaRef.CreateRecoveryExpr(
1669+
UninstExpr->getBeginLoc(), UninstExpr->getEndLoc(), {UninstExpr},
1670+
UninstExpr->getType());
1671+
if (ErrorResult.isUsable())
1672+
PVD->setDefaultArg(ErrorResult.get());
16901673
}
16911674
}
1692-
#endif
16931675
return inherited::RebuildLambdaExpr(StartLoc, EndLoc, LSI);
16941676
}
16951677

0 commit comments

Comments
 (0)