Skip to content

Commit 60a2ab2

Browse files
committed
[FOLD] address some review feedback
1 parent 21c0d63 commit 60a2ab2

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
@@ -1068,11 +1068,7 @@ bool Sema::FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD) {
10681068
SmallVector<const Expr *, 3> ACs;
10691069
FTD->getAssociatedConstraints(ACs);
10701070

1071-
#if 0
1072-
unsigned OldTemplateDepth = CalculateTemplateDepthForConstraints(*this, FD);
1073-
#else
10741071
unsigned OldTemplateDepth = FTD->getTemplateParameters()->getDepth();
1075-
#endif
10761072
for (const Expr *Constraint : ACs)
10771073
if (ConstraintExpressionDependsOnEnclosingTemplate(FD, OldTemplateDepth,
10781074
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
@@ -1652,43 +1652,25 @@ namespace {
16521652

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

0 commit comments

Comments
 (0)