@@ -1754,7 +1754,7 @@ static bool isNonPlacementDeallocationFunction(Sema &S, FunctionDecl *FD) {
17541754 return false;
17551755
17561756 unsigned UsualParams = 1;
1757- if (isTypeAwareAllocation (S. allocationModeInCurrentContext ()) &&
1757+ if (S.getLangOpts().TypeAwareAllocators &&
17581758 UsualParams < FD->getNumParams() && FD->isTypeAwareOperatorNewOrDelete())
17591759 ++UsualParams;
17601760
@@ -1795,7 +1795,7 @@ namespace {
17951795 FD = InstantiatedDecl;
17961796 }
17971797 unsigned NumBaseParams = 1;
1798- if (isTypeAwareAllocation (S. allocationModeInCurrentContext ()) &&
1798+ if (S.getLangOpts().TypeAwareAllocators &&
17991799 FD->isTypeAwareOperatorNewOrDelete()) {
18001800 QualType TypeIdentityTag = FD->getParamDecl(0)->getType();
18011801 QualType ExpectedTypeIdentityTag =
@@ -2425,7 +2425,7 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
24252425 AllocType->isDependentType() ? 0 : Context.getTypeAlign(AllocType);
24262426 unsigned NewAlignment = Context.getTargetInfo().getNewAlign();
24272427 ImplicitAllocationParameters IAP = {
2428- allocationModeInCurrentContext ( ),
2428+ typeAwareAllocationModeFromBool(getLangOpts().TypeAwareAllocators ),
24292429 alignedAllocationModeFromBool(getLangOpts().AlignedAllocation &&
24302430 Alignment > NewAlignment)};
24312431
@@ -3514,7 +3514,7 @@ FunctionDecl *Sema::FindUsualDeallocationFunction(
35143514
35153515 LookupResult FoundDelete(*this, Name, StartLoc, LookupOrdinaryName);
35163516 DeallocLookupMode LookupMode =
3517- isTypeAwareAllocation ( allocationModeInCurrentContext ())
3517+ getLangOpts().TypeAwareAllocators
35183518 ? DeallocLookupMode::OptionallyTyped
35193519 : DeallocLookupMode::Untyped;
35203520 LookupGlobalDeallocationFunctions(*this, StartLoc, FoundDelete, LookupMode,
@@ -3544,7 +3544,8 @@ FunctionDecl *Sema::FindDeallocationFunctionForDestructor(SourceLocation Loc,
35443544
35453545 FunctionDecl *OperatorDelete = nullptr;
35463546 QualType DeallocType = Context.getRecordType(RD);
3547- ImplicitDeallocationParameters IDP = {allocationModeInCurrentContext (),
3547+ ImplicitDeallocationParameters IDP = {
3548+ typeAwareAllocationModeFromBool(getLangOpts().TypeAwareAllocators),
35483549 AlignedAllocationMode::No,
35493550 SizedDeallocationMode::No};
35503551
@@ -4017,7 +4018,8 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
40174018 ArrayForm ? OO_Array_Delete : OO_Delete);
40184019
40194020 if (PointeeRD) {
4020- ImplicitDeallocationParameters IDP = {allocationModeInCurrentContext (),
4021+ ImplicitDeallocationParameters IDP = {
4022+ typeAwareAllocationModeFromBool(getLangOpts().TypeAwareAllocators),
40214023 AlignedAllocationMode::No,
40224024 SizedDeallocationMode::No};
40234025 if (!UseGlobal &&
@@ -4071,7 +4073,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
40714073
40724074 // Look for a global declaration.
40734075 ImplicitDeallocationParameters IDP = {
4074- allocationModeInCurrentContext ( ),
4076+ typeAwareAllocationModeFromBool(getLangOpts().TypeAwareAllocators ),
40754077 alignedAllocationModeFromBool(Overaligned),
40764078 sizedDeallocationModeFromBool(CanProvideSize)};
40774079 OperatorDelete =
0 commit comments