Skip to content

Commit 21c0d63

Browse files
committed
[FOLD] format
1 parent a853428 commit 21c0d63

11 files changed

+153
-142
lines changed

clang/include/clang/AST/DeclTemplate.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,8 @@ class RedeclarableTemplateDecl : public TemplateDecl,
809809
};
810810

811811
/// Pointer to the common data shared by all declarations of this
812-
/// template, and a flag indicating if the template is a member specialization.
812+
/// template, and a flag indicating if the template is a member
813+
/// specialization.
813814
mutable llvm::PointerIntPair<CommonBase *, 1, bool> Common;
814815

815816
/// Retrieves the "common" pointer shared by all (re-)declarations of
@@ -857,9 +858,7 @@ class RedeclarableTemplateDecl : public TemplateDecl,
857858
/// template<> template<typename T>
858859
/// struct X<int>::Inner { /* ... */ };
859860
/// \endcode
860-
bool isMemberSpecialization() const {
861-
return Common.getInt();
862-
}
861+
bool isMemberSpecialization() const { return Common.getInt(); }
863862

864863
/// Note that this member template is a specialization.
865864
void setMemberSpecialization() {
@@ -2190,9 +2189,7 @@ class ClassTemplatePartialSpecializationDecl
21902189
}
21912190

21922191
/// Note that this member template is a specialization.
2193-
void setMemberSpecialization() {
2194-
return InstantiatedFromMember.setInt(true);
2195-
}
2192+
void setMemberSpecialization() { return InstantiatedFromMember.setInt(true); }
21962193

21972194
/// Retrieves the injected specialization type for this partial
21982195
/// specialization. This is not the same as the type-decl-type for
@@ -2947,9 +2944,7 @@ class VarTemplatePartialSpecializationDecl
29472944
}
29482945

29492946
/// Note that this member template is a specialization.
2950-
void setMemberSpecialization() {
2951-
return InstantiatedFromMember.setInt(true);
2952-
}
2947+
void setMemberSpecialization() { return InstantiatedFromMember.setInt(true); }
29532948

29542949
SourceRange getSourceRange() const override LLVM_READONLY;
29552950

clang/include/clang/Sema/Sema.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11392,7 +11392,8 @@ class Sema final : public SemaBase {
1139211392
CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
1139311393
const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
1139411394
AccessSpecifier AS, SourceLocation ModulePrivateLoc,
11395-
SourceLocation FriendLoc, ArrayRef<TemplateParameterList *> OuterTemplateParamLists,
11395+
SourceLocation FriendLoc,
11396+
ArrayRef<TemplateParameterList *> OuterTemplateParamLists,
1139611397
bool IsMemberSpecialization, SkipBodyInfo *SkipBody = nullptr);
1139711398

1139811399
/// Translates template arguments as provided by the parser
@@ -11432,7 +11433,8 @@ class Sema final : public SemaBase {
1143211433
DeclResult ActOnVarTemplateSpecialization(
1143311434
Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous,
1143411435
SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
11435-
StorageClass SC, bool IsPartialSpecialization, bool IsMemberSpecialization);
11436+
StorageClass SC, bool IsPartialSpecialization,
11437+
bool IsMemberSpecialization);
1143611438

1143711439
/// Get the specialization of the given variable template corresponding to
1143811440
/// the specified argument list, or a null-but-valid result if the arguments

clang/lib/Sema/SemaConcept.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static bool CheckConstraintSatisfaction(
586586
ArrayRef<TemplateArgument> TemplateArgs =
587587
TemplateArgsLists.getNumSubstitutedLevels() > 0
588588
? TemplateArgsLists.getInnermost()
589-
: ArrayRef<TemplateArgument> {};
589+
: ArrayRef<TemplateArgument>{};
590590
Sema::InstantiatingTemplate Inst(S, TemplateIDRange.getBegin(),
591591
Sema::InstantiatingTemplate::ConstraintsCheck{},
592592
const_cast<NamedDecl *>(Template), TemplateArgs, TemplateIDRange);
@@ -908,8 +908,8 @@ bool Sema::CheckFunctionConstraints(const FunctionDecl *FD,
908908
// Figure out the to-translation-unit depth for this function declaration for
909909
// the purpose of seeing if they differ by constraints. This isn't the same as
910910
// getTemplateDepth, because it includes already instantiated parents.
911-
static unsigned
912-
CalculateTemplateDepthForConstraints(Sema &S, const NamedDecl *ND) {
911+
static unsigned CalculateTemplateDepthForConstraints(Sema &S,
912+
const NamedDecl *ND) {
913913
MultiLevelTemplateArgumentList MLTAL = S.getTemplateInstantiationArgs(
914914
ND, ND->getLexicalDeclContext(), /*Final=*/false,
915915
/*Innermost=*/std::nullopt,
@@ -1068,11 +1068,11 @@ bool Sema::FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD) {
10681068
SmallVector<const Expr *, 3> ACs;
10691069
FTD->getAssociatedConstraints(ACs);
10701070

1071-
#if 0
1071+
#if 0
10721072
unsigned OldTemplateDepth = CalculateTemplateDepthForConstraints(*this, FD);
1073-
#else
1073+
#else
10741074
unsigned OldTemplateDepth = FTD->getTemplateParameters()->getDepth();
1075-
#endif
1075+
#endif
10761076
for (const Expr *Constraint : ACs)
10771077
if (ConstraintExpressionDependsOnEnclosingTemplate(FD, OldTemplateDepth,
10781078
Constraint))

clang/lib/Sema/SemaDecl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4505,10 +4505,10 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) {
45054505
adjustDeclContextForDeclaratorDecl(New, Old);
45064506

45074507
// Ensure the template parameters are compatible.
4508-
if (NewTemplate &&
4509-
!TemplateParameterListsAreEqual(NewTemplate, NewTemplate->getTemplateParameters(),
4510-
OldTemplate, OldTemplate->getTemplateParameters(),
4511-
/*Complain=*/true, TPL_TemplateMatch))
4508+
if (NewTemplate && !TemplateParameterListsAreEqual(
4509+
NewTemplate, NewTemplate->getTemplateParameters(),
4510+
OldTemplate, OldTemplate->getTemplateParameters(),
4511+
/*Complain=*/true, TPL_TemplateMatch))
45124512
return New->setInvalidDecl();
45134513

45144514
// C++ [class.mem]p1:

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17411,7 +17411,8 @@ DeclResult Sema::ActOnTemplatedFriendTag(
1741117411
return CheckClassTemplate(S, TagSpec, TagUseKind::Friend, TagLoc, SS,
1741217412
Name, NameLoc, Attr, TemplateParams, AS_public,
1741317413
/*ModulePrivateLoc=*/SourceLocation(),
17414-
FriendLoc, TempParamLists.drop_back(), IsMemberSpecialization)
17414+
FriendLoc, TempParamLists.drop_back(),
17415+
IsMemberSpecialization)
1741517416
.get();
1741617417
} else {
1741717418
// The "template<>" header is extraneous.

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,8 @@ DeclResult Sema::CheckClassTemplate(
17931793
CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
17941794
const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
17951795
AccessSpecifier AS, SourceLocation ModulePrivateLoc,
1796-
SourceLocation FriendLoc, ArrayRef<TemplateParameterList *> OuterTemplateParamLists,
1796+
SourceLocation FriendLoc,
1797+
ArrayRef<TemplateParameterList *> OuterTemplateParamLists,
17971798
bool IsMemberSpecialization, SkipBodyInfo *SkipBody) {
17981799
assert(TemplateParams && TemplateParams->size() > 0 &&
17991800
"No template parameters");
@@ -2058,8 +2059,7 @@ DeclResult Sema::CheckClassTemplate(
20582059
/*DelayTypeCreation=*/true);
20592060
SetNestedNameSpecifier(*this, NewClass, SS);
20602061
if (!OuterTemplateParamLists.empty())
2061-
NewClass->setTemplateParameterListsInfo(
2062-
Context, OuterTemplateParamLists);
2062+
NewClass->setTemplateParameterListsInfo(Context, OuterTemplateParamLists);
20632063

20642064
// Add alignment attributes if necessary; these attributes are checked when
20652065
// the ASTContext lays out the structure.
@@ -2102,26 +2102,28 @@ DeclResult Sema::CheckClassTemplate(
21022102
// Ensure that the template parameter lists are compatible. Skip this check
21032103
// for a friend in a dependent context: the template parameter list itself
21042104
// could be dependent.
2105-
if (ShouldAddRedecl && PrevClassTemplate && !TemplateParameterListsAreEqual(
2106-
NewTemplate, TemplateParams,
2107-
PrevClassTemplate, PrevClassTemplate->getTemplateParameters(),
2108-
/*Complain=*/true, TPL_TemplateMatch))
2105+
if (ShouldAddRedecl && PrevClassTemplate &&
2106+
!TemplateParameterListsAreEqual(
2107+
NewTemplate, TemplateParams, PrevClassTemplate,
2108+
PrevClassTemplate->getTemplateParameters(),
2109+
/*Complain=*/true, TPL_TemplateMatch))
21092110
return true;
21102111

21112112
// Check the template parameter list of this declaration, possibly
21122113
// merging in the template parameter list from the previous class
21132114
// template declaration. Skip this check for a friend in a dependent
21142115
// context, because the template parameter list might be dependent.
2115-
if (ShouldAddRedecl && CheckTemplateParameterList(
2116-
TemplateParams,
2117-
PrevClassTemplate ? PrevClassTemplate->getTemplateParameters()
2118-
: nullptr,
2119-
(SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
2120-
SemanticContext->isDependentContext())
2121-
? TPC_ClassTemplateMember
2122-
: TUK == TagUseKind::Friend ? TPC_FriendClassTemplate
2123-
: TPC_ClassTemplate,
2124-
SkipBody))
2116+
if (ShouldAddRedecl &&
2117+
CheckTemplateParameterList(
2118+
TemplateParams,
2119+
PrevClassTemplate ? PrevClassTemplate->getTemplateParameters()
2120+
: nullptr,
2121+
(SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
2122+
SemanticContext->isDependentContext())
2123+
? TPC_ClassTemplateMember
2124+
: TUK == TagUseKind::Friend ? TPC_FriendClassTemplate
2125+
: TPC_ClassTemplate,
2126+
SkipBody))
21252127
Invalid = true;
21262128

21272129
if (TUK == TagUseKind::Definition && (!SkipBody || !SkipBody->ShouldSkip))
@@ -3961,7 +3963,8 @@ void Sema::CheckDeductionGuideTemplate(FunctionTemplateDecl *TD) {
39613963
DeclResult Sema::ActOnVarTemplateSpecialization(
39623964
Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous,
39633965
SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
3964-
StorageClass SC, bool IsPartialSpecialization, bool IsMemberSpecialization) {
3966+
StorageClass SC, bool IsPartialSpecialization,
3967+
bool IsMemberSpecialization) {
39653968
// D must be variable template id.
39663969
assert(D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId &&
39673970
"Variable template specialization is declared with a template id.");
@@ -8285,15 +8288,12 @@ DeclResult Sema::ActOnClassTemplateSpecialization(
82858288
Diag(TemplateNameLoc, diag::err_partial_spec_args_match_primary_template)
82868289
<< /*class template*/ 0 << (TUK == TagUseKind::Definition)
82878290
<< FixItHint::CreateRemoval(SourceRange(LAngleLoc, RAngleLoc));
8288-
return CheckClassTemplate(S, TagSpec, TUK, KWLoc, SS,
8289-
ClassTemplate->getIdentifier(),
8290-
TemplateNameLoc,
8291-
Attr,
8292-
TemplateParams,
8293-
AS_none, /*ModulePrivateLoc=*/SourceLocation(),
8294-
/*FriendLoc*/SourceLocation(),
8295-
TemplateParameterLists.drop_back(),
8296-
isMemberSpecialization);
8291+
return CheckClassTemplate(
8292+
S, TagSpec, TUK, KWLoc, SS, ClassTemplate->getIdentifier(),
8293+
TemplateNameLoc, Attr, TemplateParams, AS_none,
8294+
/*ModulePrivateLoc=*/SourceLocation(),
8295+
/*FriendLoc*/ SourceLocation(), TemplateParameterLists.drop_back(),
8296+
isMemberSpecialization);
82978297
}
82988298

82998299
// Create a new class template partial specialization declaration node.

clang/lib/Sema/SemaTemplateDeductionGuide.cpp

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

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

323324
Sema &SemaRef;
@@ -786,8 +787,7 @@ buildAssociatedConstraints(Sema &SemaRef, FunctionTemplateDecl *F,
786787
getDepthAndIndex(TP).first + AdjustDepth);
787788
FirstUndeducedParamIdx += 1;
788789
assert(InnerArgsForBuildingRC[Index].isNull());
789-
InnerArgsForBuildingRC[Index] =
790-
Context.getInjectedTemplateArg(NewParam);
790+
InnerArgsForBuildingRC[Index] = Context.getInjectedTemplateArg(NewParam);
791791
continue;
792792
}
793793
TemplateArgumentLoc Input =
@@ -828,11 +828,12 @@ buildAssociatedConstraints(Sema &SemaRef, FunctionTemplateDecl *F,
828828
// NOTE: The underlying deduction guide F is instantiated -- either from an
829829
// explicitly-written deduction guide member, or from a constructor.
830830
MultiLevelTemplateArgumentList ArgsForBuildingRC =
831-
SemaRef.getTemplateInstantiationArgs(
832-
F, F->getLexicalDeclContext(),
833-
/*Final=*/false, /*Innermost=*/InnerArgsForBuildingRC,
834-
/*RelativeToPrimary=*/true,
835-
/*ForConstraintInstantiation=*/true);;
831+
SemaRef.getTemplateInstantiationArgs(F, F->getLexicalDeclContext(),
832+
/*Final=*/false,
833+
/*Innermost=*/InnerArgsForBuildingRC,
834+
/*RelativeToPrimary=*/true,
835+
/*ForConstraintInstantiation=*/true);
836+
;
836837
ArgsForBuildingRC.setKind(clang::TemplateSubstitutionKind::Rewrite);
837838

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

0 commit comments

Comments
 (0)