Skip to content

Commit ae0729d

Browse files
committed
Remember to run clang-format
1 parent dbe0f5f commit ae0729d

File tree

9 files changed

+41
-27
lines changed

9 files changed

+41
-27
lines changed

clang/include/clang/AST/Decl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,11 +2564,12 @@ class FunctionDecl : public DeclaratorDecl,
25642564

25652565
/// Count of mandatory parameters for type aware operator new
25662566
static constexpr unsigned RequiredTypeAwareNewParameterCount =
2567-
/* type-identity */ 1 + /* size */ 1 + /* alignment */ 1;
2567+
/* type-identity */ 1 + /* size */ 1 + /* alignment */ 1;
25682568

25692569
/// Count of mandatory parameters for type aware operator delete
25702570
static constexpr unsigned RequiredTypeAwareDeleteParameterCount =
2571-
/* type-identity */ 1 + /* address */ 1 + /* size */ 1 + /* alignment */ 1;
2571+
/* type-identity */ 1 + /* address */ 1 + /* size */ 1 +
2572+
/* alignment */ 1;
25722573

25732574
/// Determine whether this is a type aware operator new or delete.
25742575
bool isTypeAwareOperatorNewOrDelete() const;

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2639,7 +2639,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
26392639
bool isTypeIdentitySpecialization() const; // std::type_identity<X> for any X
26402640
bool isDestroyingDeleteT() const;
26412641

2642-
TemplateDecl *TryGetSpecializedTemplateDecl() const;
2642+
TemplateDecl *tryGetSpecializedTemplateDecl() const;
26432643

26442644
#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
26452645
bool is##Id##Type() const;

clang/lib/AST/Decl.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,9 +3400,12 @@ bool FunctionDecl::isUsableAsGlobalAllocationFunctionInConstantEvaluation(
34003400

34013401
if (isTypeAwareOperatorNewOrDelete()) {
34023402
bool IsDelete = getDeclName().isOperatorDelete();
3403-
unsigned RequiredParameterCount = IsDelete ? FunctionDecl::RequiredTypeAwareDeleteParameterCount : FunctionDecl::RequiredTypeAwareNewParameterCount;
3403+
unsigned RequiredParameterCount =
3404+
IsDelete ? FunctionDecl::RequiredTypeAwareDeleteParameterCount
3405+
: FunctionDecl::RequiredTypeAwareNewParameterCount;
34043406
if (AlignmentParam)
3405-
*AlignmentParam = /* type identity */ 1 + /* address */ IsDelete + /* size */ 1;
3407+
*AlignmentParam =
3408+
/* type identity */ 1 + /* address */ IsDelete + /* size */ 1;
34063409
if (RequiredParameterCount == getNumParams())
34073410
return true;
34083411
if (getNumParams() > RequiredParameterCount + 1)
@@ -3411,7 +3414,7 @@ bool FunctionDecl::isUsableAsGlobalAllocationFunctionInConstantEvaluation(
34113414
return false;
34123415

34133416
if (IsNothrow)
3414-
*IsNothrow = true;
3417+
*IsNothrow = true;
34153418
return true;
34163419
}
34173420

clang/lib/AST/DeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2535,7 +2535,7 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
25352535

25362536
bool IsTypeAware = isTypeAwareOperatorNewOrDelete();
25372537
if (IsTypeAware && isVariadic())
2538-
return false;
2538+
return false;
25392539

25402540
// C++ [basic.stc.dynamic.deallocation]p2:
25412541
// Pre-type aware allocators:

clang/lib/AST/Type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,7 +3140,7 @@ bool Type::isDestroyingDeleteT() const {
31403140
RD->getIdentifier()->isStr("destroying_delete_t");
31413141
}
31423142

3143-
TemplateDecl *Type::TryGetSpecializedTemplateDecl() const {
3143+
TemplateDecl *Type::tryGetSpecializedTemplateDecl() const {
31443144
auto UnderlyingType = getCanonicalTypeInternal();
31453145
if (auto *TST = UnderlyingType->getAs<TemplateSpecializationType>())
31463146
return TST->getTemplateName().getAsTemplateDecl();
@@ -3152,7 +3152,7 @@ TemplateDecl *Type::TryGetSpecializedTemplateDecl() const {
31523152
}
31533153

31543154
bool Type::isTypeIdentitySpecialization() const {
3155-
const TemplateDecl *STDecl = TryGetSpecializedTemplateDecl();
3155+
const TemplateDecl *STDecl = tryGetSpecializedTemplateDecl();
31563156
if (!STDecl)
31573157
return false;
31583158
IdentifierInfo *II = STDecl->getIdentifier();

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7189,7 +7189,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
71897189
CmdArgs.push_back("-fcoro-aligned-allocation");
71907190

71917191
if (Arg *A = Args.getLastArg(options::OPT_fcxx_type_aware_allocators,
7192-
options::OPT_fno_cxx_type_aware_allocators)) {
7192+
options::OPT_fno_cxx_type_aware_allocators)) {
71937193
if (A->getOption().matches(options::OPT_fno_cxx_type_aware_allocators))
71947194
CmdArgs.push_back("-fno-cxx-type-aware-allocators");
71957195
else

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16349,7 +16349,7 @@ Sema::BuildTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1634916349

1635016350
unsigned NumParams = FnDecl->getNumParams();
1635116351
constexpr unsigned RequiredParameterCount =
16352-
FunctionDecl::RequiredTypeAwareDeleteParameterCount;
16352+
FunctionDecl::RequiredTypeAwareDeleteParameterCount;
1635316353
// A usual deallocation function has no placement parameters
1635416354
if (NumParams != RequiredParameterCount)
1635516355
return nullptr;
@@ -16435,8 +16435,9 @@ static inline bool CheckOperatorNewDeleteTypes(
1643516435
};
1643616436

1643716437
unsigned FirstNonTypeParam = 0;
16438-
bool IsPotentiallyTypeAware = FnDecl->getNumParams() > 0 &&
16439-
FnDecl->getParamDecl(0)->getType()->isTypeIdentitySpecialization();
16438+
bool IsPotentiallyTypeAware =
16439+
FnDecl->getNumParams() > 0 &&
16440+
FnDecl->getParamDecl(0)->getType()->isTypeIdentitySpecialization();
1644016441
unsigned MinimumMandatoryArgumentCount = 1;
1644116442
unsigned SizeParameterIndex = 0;
1644216443
if (IsPotentiallyTypeAware) {
@@ -16449,10 +16450,12 @@ static inline bool CheckOperatorNewDeleteTypes(
1644916450

1645016451
if (OperatorKind == AllocationOperatorKind::New) {
1645116452
SizeParameterIndex = 1;
16452-
MinimumMandatoryArgumentCount = FunctionDecl::RequiredTypeAwareNewParameterCount;
16453+
MinimumMandatoryArgumentCount =
16454+
FunctionDecl::RequiredTypeAwareNewParameterCount;
1645316455
} else {
1645416456
SizeParameterIndex = 2;
16455-
MinimumMandatoryArgumentCount = FunctionDecl::RequiredTypeAwareDeleteParameterCount;
16457+
MinimumMandatoryArgumentCount =
16458+
FunctionDecl::RequiredTypeAwareDeleteParameterCount;
1645616459
}
1645716460
FirstNonTypeParam = 1;
1645816461
}
@@ -16466,8 +16469,8 @@ static inline bool CheckOperatorNewDeleteTypes(
1646616469
if (FnDecl->getNumParams() < MinimumMandatoryArgumentCount)
1646716470
return SemaRef.Diag(FnDecl->getLocation(),
1646816471
diag::err_operator_new_delete_too_few_parameters)
16469-
<< IsPotentiallyTypeAware << IsDestroyingDelete << FnDecl->getDeclName()
16470-
<< MinimumMandatoryArgumentCount;
16472+
<< IsPotentiallyTypeAware << IsDestroyingDelete
16473+
<< FnDecl->getDeclName() << MinimumMandatoryArgumentCount;
1647116474

1647216475
auto *FnType = FnDecl->getType()->castAs<FunctionType>();
1647316476
QualType CanResultType = NormalizeType(FnType->getReturnType());
@@ -16496,8 +16499,8 @@ static inline bool CheckOperatorNewDeleteTypes(
1649616499
auto FallbackType) -> bool {
1649716500
if (ExpectedType.isNull()) {
1649816501
return SemaRef.Diag(FnDecl->getLocation(), InvalidParamTypeDiag)
16499-
<< IsPotentiallyTypeAware << IsDestroyingDelete << FnDecl->getDeclName()
16500-
<< ParamIdx << FallbackType;
16502+
<< IsPotentiallyTypeAware << IsDestroyingDelete
16503+
<< FnDecl->getDeclName() << ParamIdx << FallbackType;
1650116504
}
1650216505
CanQualType CanExpectedTy =
1650316506
NormalizeType(SemaRef.Context.getCanonicalType(ExpectedType));
@@ -16509,8 +16512,8 @@ static inline bool CheckOperatorNewDeleteTypes(
1650916512
? DependentParamTypeDiag
1651016513
: InvalidParamTypeDiag;
1651116514
return SemaRef.Diag(FnDecl->getLocation(), Diagnostic)
16512-
<< IsPotentiallyTypeAware << IsDestroyingDelete << FnDecl->getDeclName()
16513-
<< ParamIdx << ExpectedType << FallbackType;
16515+
<< IsPotentiallyTypeAware << IsDestroyingDelete
16516+
<< FnDecl->getDeclName() << ParamIdx << ExpectedType << FallbackType;
1651416517
};
1651516518

1651616519
// Check that the first parameter type is what we expect.
@@ -16581,7 +16584,7 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1658116584
auto ConstructDestroyingDeleteAddressType = [&]() {
1658216585
assert(MD);
1658316586
return SemaRef.Context.getCanonicalType(SemaRef.Context.getPointerType(
16584-
SemaRef.Context.getRecordType(MD->getParent())));
16587+
SemaRef.Context.getRecordType(MD->getParent())));
1658516588
};
1658616589

1658716590
// C++ P0722:
@@ -16598,7 +16601,8 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1659816601
// so as a QoL we actually check for this explicitly
1659916602
bool IsTypeAwareClassMethod = MD && MD->isTypeAwareOperatorNewOrDelete();
1660016603
if (IsTypeAwareClassMethod && MD->getNumParams() > 1) {
16601-
QualType AddressParamType = SemaRef.Context.getCanonicalType(MD->getParamDecl(1)->getType());
16604+
QualType AddressParamType =
16605+
SemaRef.Context.getCanonicalType(MD->getParamDecl(1)->getType());
1660216606
if (AddressParamType != SemaRef.Context.VoidPtrTy &&
1660316607
AddressParamType == ConstructDestroyingDeleteAddressType()) {
1660416608
// The address parameter type implies an author trying to construct a
@@ -16610,7 +16614,9 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1661016614
// the core problem.
1661116615
for (auto Param : MD->parameters()) {
1661216616
if (Param->getType()->isDestroyingDeleteT()) {
16613-
SemaRef.Diag(MD->getLocation(), diag::err_type_aware_destroying_operator_delete) << Param->getLocation();
16617+
SemaRef.Diag(MD->getLocation(),
16618+
diag::err_type_aware_destroying_operator_delete)
16619+
<< Param->getLocation();
1661416620
return true;
1661516621
}
1661616622
}
@@ -16627,7 +16633,9 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1662716633
diag::err_operator_delete_param_type, &MinimumNonDefaultArgs))
1662816634
return true;
1662916635

16630-
assert(MinimumNonDefaultArgs > 0 && MinimumNonDefaultArgs <= FunctionDecl::RequiredTypeAwareDeleteParameterCount);
16636+
assert(MinimumNonDefaultArgs > 0 &&
16637+
MinimumNonDefaultArgs <=
16638+
FunctionDecl::RequiredTypeAwareDeleteParameterCount);
1663116639
// C++ P0722:
1663216640
// A destroying operator delete shall be a usual deallocation function.
1663316641
if (MD && !MD->getParent()->isDependentContext() &&
@@ -16646,6 +16654,7 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1664616654
<< FnDecl->getDeclName() << ParamDecl->getDefaultArgRange();
1664716655
}
1664816656
}
16657+
1664916658
return false;
1665016659
}
1665116660

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,8 @@ static bool isNonPlacementDeallocationFunction(Sema &S, FunctionDecl *FD) {
17551755

17561756
if (S.getLangOpts().TypeAwareAllocators &&
17571757
FD->isTypeAwareOperatorNewOrDelete())
1758-
return FunctionDecl::RequiredTypeAwareDeleteParameterCount == FD->getNumParams();
1758+
return FunctionDecl::RequiredTypeAwareDeleteParameterCount ==
1759+
FD->getNumParams();
17591760

17601761
unsigned UsualParams = 1;
17611762
if (S.getLangOpts().SizedDeallocation && UsualParams < FD->getNumParams() &&

clang/lib/Sema/SemaInit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9902,7 +9902,7 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
99029902
// C++ [over.match.class.deduct#3]: ..., the defining-type-id of A must be
99039903
// of the form
99049904
// [typename] [nested-name-specifier] [template] simple-template-id
9905-
auto SpecializedTD = UnderlyingType->TryGetSpecializedTemplateDecl();
9905+
auto SpecializedTD = UnderlyingType->tryGetSpecializedTemplateDecl();
99069906
Template = dyn_cast_or_null<ClassTemplateDecl>(SpecializedTD);
99079907
}
99089908
}

0 commit comments

Comments
 (0)