Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed May 13, 2024
1 parent 0bdb18c commit 8e2a2a4
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2776,21 +2776,18 @@ NamedDecl *transformTemplateParameter(Sema &SemaRef, DeclContext *DC,
return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth,
NewIndex);
if (auto *TTP = dyn_cast<TemplateTemplateParmDecl>(TemplateParam))
return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex,
NewDepth);
return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, NewDepth);
if (auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(TemplateParam))
return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex,
NewDepth);
return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, NewDepth);
llvm_unreachable("Unhandled template parameter types");
}

// Transform the require-clause of F if any.
// The return result is expected to be the require-clause for the synthesized
// alias deduction guide.
Expr *transformRequireClause(
Sema &SemaRef, FunctionTemplateDecl *F,
TypeAliasTemplateDecl *AliasTemplate,
ArrayRef<DeducedTemplateArgument> DeduceResults) {
Expr *transformRequireClause(Sema &SemaRef, FunctionTemplateDecl *F,
TypeAliasTemplateDecl *AliasTemplate,
ArrayRef<DeducedTemplateArgument> DeduceResults) {
Expr *RC = F->getTemplateParameters()->getRequiresClause();
if (!RC)
return nullptr;
Expand All @@ -2816,7 +2813,8 @@ Expr *transformRequireClause(
// For 1), if the alias template is nested within a class template, we
// calcualte the 'uninstantiated' depth by adding the substitution level back.
unsigned AdjustDepth = 0;
if (auto *PrimaryTemplate = AliasTemplate->getInstantiatedFromMemberTemplate())
if (auto *PrimaryTemplate =
AliasTemplate->getInstantiatedFromMemberTemplate())
AdjustDepth = PrimaryTemplate->getTemplateDepth();

// We rebuild all template parameters with the uninstantiated depth, and
Expand Down Expand Up @@ -3040,7 +3038,8 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
Args.addOuterTemplateArguments(TransformedDeducedAliasArgs);
NamedDecl *NewParam = transformTemplateParameter(
SemaRef, AliasTemplate->getDeclContext(), TP, Args,
/*NewIndex=*/FPrimeTemplateParams.size(), getTemplateParameterDepth(TP));
/*NewIndex=*/FPrimeTemplateParams.size(),
getTemplateParameterDepth(TP));
FPrimeTemplateParams.push_back(NewParam);

auto NewTemplateArgument = Context.getCanonicalTemplateArgument(
Expand Down Expand Up @@ -3113,8 +3112,8 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
Sema::CodeSynthesisContext::BuildingDeductionGuides)) {
auto *GG = cast<CXXDeductionGuideDecl>(FPrime);

Expr *RequiresClause = transformRequireClause(
SemaRef, F, AliasTemplate, DeduceResults);
Expr *RequiresClause =
transformRequireClause(SemaRef, F, AliasTemplate, DeduceResults);

// FIXME: implement the is_deducible constraint per C++
// [over.match.class.deduct]p3.3:
Expand Down

0 comments on commit 8e2a2a4

Please sign in to comment.