@@ -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
0 commit comments