@@ -9711,7 +9711,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD,
97119711 // results in an ambiguity or in a function that is deleted or inaccessible
97129712 if (CSM == CXXSpecialMemberKind::Destructor && MD->isVirtual()) {
97139713 FunctionDecl *OperatorDelete = nullptr;
9714- auto DeallocType = Context.getRecordType(RD);
9714+ QualType DeallocType = Context.getRecordType(RD);
97159715 DeclarationName Name =
97169716 Context.DeclarationNames.getCXXOperatorName(OO_Delete);
97179717 ImplicitDeallocationParameters IDP = {.PassTypeIdentity =
@@ -10872,7 +10872,7 @@ bool Sema::CheckDestructor(CXXDestructorDecl *Destructor) {
1087210872 // first parameter, perform that conversion now.
1087310873 if (OperatorDelete->isDestroyingOperatorDelete()) {
1087410874 unsigned PointerParam = 0;
10875- if (IsTypeAwareOperatorNewOrDelete (OperatorDelete)) {
10875+ if (isTypeAwareOperatorNewOrDelete (OperatorDelete)) {
1087610876 ++PointerParam;
1087710877 }
1087810878 QualType ParamType =
@@ -16123,47 +16123,47 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,
1612316123 return Invalid;
1612416124}
1612516125
16126- bool Sema::IsTypeIdentitySpecialization (QualType Type) const {
16127- auto *TypeIdentity = getStdTypeIdentity();
16126+ bool Sema::isTypeIdentitySpecialization (QualType Type) const {
16127+ ClassTemplateDecl *TypeIdentity = getStdTypeIdentity();
1612816128 if (!TypeIdentity)
1612916129 return false;
16130- auto *SpecializedDecl = Type->getSpecializedTemplateDecl();
16130+ const TemplateDecl *SpecializedDecl = Type->getSpecializedTemplateDecl();
1613116131 return TypeIdentity == SpecializedDecl;
1613216132}
1613316133
16134- bool Sema::IsTypeAwareOperatorNewOrDelete (const FunctionDecl *FnDecl) const {
16134+ bool Sema::isTypeAwareOperatorNewOrDelete (const FunctionDecl *FnDecl) const {
1613516135 // Type aware operators
1613616136 if (FnDecl->getNumParams() < 2)
1613716137 return false;
16138- const auto *ParamDecl = FnDecl->getParamDecl(0);
16139- return IsTypeIdentitySpecialization (ParamDecl->getType());
16138+ const ParmVarDecl *ParamDecl = FnDecl->getParamDecl(0);
16139+ return isTypeIdentitySpecialization (ParamDecl->getType());
1614016140}
1614116141
16142- bool Sema::IsTypeAwareOperatorNewOrDelete (
16142+ bool Sema::isTypeAwareOperatorNewOrDelete (
1614316143 const FunctionTemplateDecl *FTD) const {
16144- return IsTypeAwareOperatorNewOrDelete (FTD->getTemplatedDecl());
16144+ return isTypeAwareOperatorNewOrDelete (FTD->getTemplatedDecl());
1614516145}
1614616146
16147- bool Sema::IsTypeAwareOperatorNewOrDelete (const NamedDecl *ND) const {
16147+ bool Sema::isTypeAwareOperatorNewOrDelete (const NamedDecl *ND) const {
1614816148 if (auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
16149- return IsTypeAwareOperatorNewOrDelete (FTD->getTemplatedDecl());
16149+ return isTypeAwareOperatorNewOrDelete (FTD->getTemplatedDecl());
1615016150 if (auto *FnDecl = dyn_cast<FunctionDecl>(ND))
16151- return IsTypeAwareOperatorNewOrDelete (FnDecl);
16151+ return isTypeAwareOperatorNewOrDelete (FnDecl);
1615216152 return false;
1615316153}
1615416154
1615516155std::optional<FunctionDecl *>
16156- Sema::InstantiateTypeAwareUsualDelete (FunctionTemplateDecl *FnTemplateDecl,
16156+ Sema::instantiateTypeAwareUsualDelete (FunctionTemplateDecl *FnTemplateDecl,
1615716157 QualType DeallocType) {
1615816158 if (!AllowTypeAwareAllocators())
1615916159 return std::nullopt;
1616016160
16161- auto TemplateParameters = FnTemplateDecl->getTemplateParameters();
16161+ TemplateParameterList * TemplateParameters = FnTemplateDecl->getTemplateParameters();
1616216162 if (TemplateParameters->hasParameterPack())
1616316163 return std::nullopt;
1616416164
16165- auto FnDecl = FnTemplateDecl->getTemplatedDecl();
16166- if (!IsTypeAwareOperatorNewOrDelete (FnDecl))
16165+ FunctionDecl * FnDecl = FnTemplateDecl->getTemplatedDecl();
16166+ if (!isTypeAwareOperatorNewOrDelete (FnDecl))
1616716167 return std::nullopt;
1616816168
1616916169 if (FnDecl->isVariadic())
@@ -16176,13 +16176,13 @@ Sema::InstantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1617616176 for (size_t Idx = 1; Idx < NumParams; ++Idx) {
1617716177 // A type aware allocation is only usual if the only dependent parameter is
1617816178 // the first parameter
16179- const auto *ParamDecl = FnDecl->getParamDecl(Idx);
16179+ const ParmVarDecl *ParamDecl = FnDecl->getParamDecl(Idx);
1618016180 if (ParamDecl->getType()->isDependentType())
1618116181 return std::nullopt;
1618216182 }
1618316183
16184- auto SpecializedTypeIdentity =
16185- InstantiateSpecializedTypeIdentity (DeallocType);
16184+ std::optional<QualType> SpecializedTypeIdentity =
16185+ instantiateSpecializedTypeIdentity (DeallocType);
1618616186 if (!SpecializedTypeIdentity)
1618716187 return std::nullopt;
1618816188 SmallVector<QualType, 4> ArgTypes;
@@ -16191,21 +16191,21 @@ Sema::InstantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1619116191 ArgTypes.push_back(FnDecl->getParamDecl(1)->getType());
1619216192 unsigned UsualParamsIdx = 2;
1619316193 if (UsualParamsIdx < NumParams && FnDecl->isDestroyingOperatorDelete()) {
16194- auto Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
16194+ QualType Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
1619516195 ArgTypes.push_back(Type);
1619616196 ++UsualParamsIdx;
1619716197 }
1619816198
1619916199 if (UsualParamsIdx < NumParams) {
16200- auto Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
16200+ QualType Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
1620116201 if (Context.hasSameUnqualifiedType(Type, Context.getSizeType())) {
1620216202 ArgTypes.push_back(Type);
1620316203 ++UsualParamsIdx;
1620416204 }
1620516205 }
1620616206
1620716207 if (UsualParamsIdx < NumParams) {
16208- auto Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
16208+ QualType Type = FnDecl->getParamDecl(UsualParamsIdx)->getType();
1620916209 if (Type->isAlignValT()) {
1621016210 ArgTypes.push_back(Type);
1621116211 ++UsualParamsIdx;
@@ -16216,7 +16216,7 @@ Sema::InstantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1621616216 return std::nullopt;
1621716217
1621816218 FunctionProtoType::ExtProtoInfo EPI;
16219- auto ExpectedFunctionType =
16219+ QualType ExpectedFunctionType =
1622016220 Context.getFunctionType(Context.VoidTy, ArgTypes, EPI);
1622116221 SourceLocation Loc;
1622216222 sema::TemplateDeductionInfo Info(Loc);
@@ -16228,17 +16228,17 @@ Sema::InstantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1622816228}
1622916229
1623016230std::optional<QualType>
16231- Sema::InstantiateSpecializedTypeIdentity (QualType Subject) {
16231+ Sema::instantiateSpecializedTypeIdentity (QualType Subject) {
1623216232 assert(AllowTypeAwareAllocators());
16233- auto *TypeIdentity = getStdTypeIdentity();
16233+ ClassTemplateDecl *TypeIdentity = getStdTypeIdentity();
1623416234 if (!TypeIdentity) {
1623516235 return std::nullopt;
1623616236 }
1623716237 auto TN = TemplateName(TypeIdentity);
1623816238 TemplateArgumentListInfo Arguments;
1623916239 Arguments.addArgument(getTrivialTemplateArgumentLoc(
1624016240 TemplateArgument(Subject), QualType(), SourceLocation()));
16241- auto Result = CheckTemplateIdType(TN, SourceLocation(), Arguments);
16241+ QualType Result = CheckTemplateIdType(TN, SourceLocation(), Arguments);
1624216242 if (Result.isNull())
1624316243 return std::nullopt;
1624416244 return Result;
@@ -16288,8 +16288,8 @@ static inline bool CheckOperatorNewDeleteTypes(
1628816288 };
1628916289 auto *FnType = FnDecl->getType()->castAs<FunctionType>();
1629016290 QualType CanResultType = NormalizeType(FnType->getReturnType());
16291- auto CanExpectedResultType = NormalizeType(ExpectedResultType);
16292- auto CanExpectedFirstParamType = NormalizeType(ExpectedFirstParamType);
16291+ QualType CanExpectedResultType = NormalizeType(ExpectedResultType);
16292+ QualType CanExpectedFirstParamType = NormalizeType(ExpectedFirstParamType);
1629316293
1629416294 // Check that the result type is what we expect.
1629516295 if (CanResultType != CanExpectedResultType) {
@@ -16310,7 +16310,7 @@ static inline bool CheckOperatorNewDeleteTypes(
1631016310 << FnDecl->getDeclName();
1631116311
1631216312 unsigned FirstNonTypeParam = 0;
16313- if (FnDecl->IsTypeAwareOperatorNewOrDelete ()) {
16313+ if (FnDecl->isTypeAwareOperatorNewOrDelete ()) {
1631416314 if (!SemaRef.getLangOpts().TypeAwareAllocators) {
1631516315 return SemaRef.Diag(FnDecl->getLocation(),
1631616316 diag::err_unsupported_type_aware_allocator);
@@ -16367,7 +16367,7 @@ CheckOperatorNewDeclaration(Sema &SemaRef, const FunctionDecl *FnDecl) {
1636716367 // C++ [basic.stc.dynamic.allocation]p1:
1636816368 // The first parameter shall not have an associated default argument.
1636916369 for (unsigned Idx = 0; Idx < MinimumNonDefaultArgs; ++Idx) {
16370- auto *ParamDecl = FnDecl->getParamDecl(Idx);
16370+ const ParmVarDecl *ParamDecl = FnDecl->getParamDecl(Idx);
1637116371 if (ParamDecl->hasDefaultArg()) {
1637216372 return SemaRef.Diag(FnDecl->getLocation(),
1637316373 diag::err_operator_new_default_arg)
@@ -16417,15 +16417,15 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef, FunctionDecl *FnDecl) {
1641716417 diag::err_destroying_operator_delete_not_usual);
1641816418 return true;
1641916419 }
16420- if (MD->IsTypeAwareOperatorNewOrDelete () &&
16420+ if (MD->isTypeAwareOperatorNewOrDelete () &&
1642116421 !SemaRef.getLangOpts().TypeAwareDestroyingDelete) {
1642216422 SemaRef.Diag(MD->getLocation(),
1642316423 diag::err_type_aware_destroying_operator_delete);
1642416424 return true;
1642516425 }
1642616426 }
1642716427 for (unsigned Idx = 0; Idx < MinimumNonDefaultArgs; ++Idx) {
16428- auto *ParamDecl = FnDecl->getParamDecl(Idx);
16428+ const ParmVarDecl *ParamDecl = FnDecl->getParamDecl(Idx);
1642916429 if (ParamDecl->hasDefaultArg()) {
1643016430 return SemaRef.Diag(FnDecl->getLocation(),
1643116431 diag::err_operator_new_default_arg)
0 commit comments