Skip to content

Commit 63cd2d6

Browse files
committed
Renaming this function to be more clear that it is not just a lang opt
1 parent cc2452c commit 63cd2d6

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,7 @@ class Sema final : public SemaBase {
21352135
isConstantEvaluatedOverride;
21362136
}
21372137

2138-
bool AllowTypeAwareAllocators() const {
2138+
bool AllowTypeAwareAllocatorsInCurrentContext() const {
21392139
return getLangOpts().TypeAwareAllocators && !isConstantEvaluatedContext();
21402140
}
21412141

clang/lib/Sema/SemaCoroutine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ static bool findDeleteForPromise(Sema &S, SourceLocation Loc, QualType PromiseTy
11131113
// scope of the promise type. If nothing is found, a search is performed in
11141114
// the global scope.
11151115
ImplicitDeallocationParameters IDP = {
1116-
typeAwareAllocation(S.AllowTypeAwareAllocators()),
1116+
typeAwareAllocation(S.AllowTypeAwareAllocatorsInCurrentContext()),
11171117
alignedAllocation(Overaligned), SizedDeallocation::Yes};
11181118
if (S.FindDeallocationFunction(Loc, PointeeRD, DeleteName, OperatorDelete,
11191119
PromiseType, IDP, /*Diagnose*/ true))
@@ -1426,7 +1426,7 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
14261426
// Helper function to indicate whether the last lookup found the aligned
14271427
// allocation function.
14281428
ImplicitAllocationParameters IAP = {
1429-
typeAwareAllocation(S.AllowTypeAwareAllocators()),
1429+
typeAwareAllocation(S.AllowTypeAwareAllocatorsInCurrentContext()),
14301430
alignedAllocation(S.getLangOpts().CoroAlignedAllocation)};
14311431
auto LookupAllocationFunction =
14321432
[&](Sema::AllocationFunctionScope NewScope = Sema::AFS_Both,
@@ -1442,7 +1442,7 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
14421442
if (NewScope == Sema::AFS_Both)
14431443
NewScope = PromiseContainsNew ? Sema::AFS_Class : Sema::AFS_Global;
14441444

1445-
IAP = {typeAwareAllocation(S.AllowTypeAwareAllocators()),
1445+
IAP = {typeAwareAllocation(S.AllowTypeAwareAllocatorsInCurrentContext()),
14461446
alignedAllocation(!ForceNonAligned &&
14471447
S.getLangOpts().CoroAlignedAllocation)};
14481448

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9715,7 +9715,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD,
97159715
DeclarationName Name =
97169716
Context.DeclarationNames.getCXXOperatorName(OO_Delete);
97179717
ImplicitDeallocationParameters IDP = {
9718-
typeAwareAllocation(AllowTypeAwareAllocators()), AlignedAllocation::No,
9718+
typeAwareAllocation(AllowTypeAwareAllocatorsInCurrentContext()), AlignedAllocation::No,
97199719
SizedDeallocation::No};
97209720
if (FindDeallocationFunction(MD->getLocation(), MD->getParent(), Name,
97219721
OperatorDelete, DeallocType, IDP,
@@ -16159,7 +16159,7 @@ bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
1615916159
std::optional<FunctionDecl *>
1616016160
Sema::instantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1616116161
QualType DeallocType) {
16162-
if (!AllowTypeAwareAllocators())
16162+
if (!AllowTypeAwareAllocatorsInCurrentContext())
1616316163
return std::nullopt;
1616416164

1616516165
TemplateParameterList *TemplateParameters =
@@ -16234,7 +16234,7 @@ Sema::instantiateTypeAwareUsualDelete(FunctionTemplateDecl *FnTemplateDecl,
1623416234

1623516235
std::optional<QualType>
1623616236
Sema::instantiateSpecializedTypeIdentity(QualType Subject) {
16237-
assert(AllowTypeAwareAllocators());
16237+
assert(AllowTypeAwareAllocatorsInCurrentContext());
1623816238
ClassTemplateDecl *TypeIdentity = getStdTypeIdentity();
1623916239
if (!TypeIdentity)
1624016240
return std::nullopt;

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,7 +1754,7 @@ static bool isNonPlacementDeallocationFunction(Sema &S, FunctionDecl *FD) {
17541754
return false;
17551755

17561756
unsigned UsualParams = 1;
1757-
if (S.AllowTypeAwareAllocators() && UsualParams < FD->getNumParams() &&
1757+
if (S.AllowTypeAwareAllocatorsInCurrentContext() && UsualParams < FD->getNumParams() &&
17581758
S.isTypeAwareOperatorNewOrDelete(FD))
17591759
++UsualParams;
17601760

@@ -1795,7 +1795,7 @@ namespace {
17951795
FD = *InstantiatedDecl;
17961796
}
17971797
unsigned NumBaseParams = 1;
1798-
if (S.AllowTypeAwareAllocators() &&
1798+
if (S.AllowTypeAwareAllocatorsInCurrentContext() &&
17991799
S.isTypeAwareOperatorNewOrDelete(FD)) {
18001800
QualType TypeIdentityTag = FD->getParamDecl(0)->getType();
18011801
std::optional<QualType> ExpectedTypeIdentityTag =
@@ -2432,7 +2432,7 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
24322432
AllocType->isDependentType() ? 0 : Context.getTypeAlign(AllocType);
24332433
unsigned NewAlignment = Context.getTargetInfo().getNewAlign();
24342434
ImplicitAllocationParameters IAP = {
2435-
typeAwareAllocation(AllowTypeAwareAllocators()),
2435+
typeAwareAllocation(AllowTypeAwareAllocatorsInCurrentContext()),
24362436
alignedAllocation(getLangOpts().AlignedAllocation &&
24372437
Alignment > NewAlignment)};
24382438

@@ -3509,7 +3509,7 @@ FunctionDecl *Sema::FindUsualDeallocationFunction(
35093509
DeclareGlobalNewDelete();
35103510

35113511
LookupResult FoundDelete(*this, Name, StartLoc, LookupOrdinaryName);
3512-
DeallocLookupMode LookupMode = AllowTypeAwareAllocators()
3512+
DeallocLookupMode LookupMode = AllowTypeAwareAllocatorsInCurrentContext()
35133513
? DeallocLookupMode::OptionallyTyped
35143514
: DeallocLookupMode::Untyped;
35153515
LookupGlobalDeallocationFunctions(*this, StartLoc, FoundDelete, LookupMode,
@@ -3540,7 +3540,7 @@ FunctionDecl *Sema::FindDeallocationFunctionForDestructor(SourceLocation Loc,
35403540
FunctionDecl *OperatorDelete = nullptr;
35413541
QualType DeallocType = Context.getRecordType(RD);
35423542
ImplicitDeallocationParameters IDP = {
3543-
typeAwareAllocation(AllowTypeAwareAllocators()), AlignedAllocation::No,
3543+
typeAwareAllocation(AllowTypeAwareAllocatorsInCurrentContext()), AlignedAllocation::No,
35443544
SizedDeallocation::No};
35453545

35463546
if (FindDeallocationFunction(Loc, RD, Name, OperatorDelete, DeallocType, IDP))
@@ -4012,7 +4012,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
40124012

40134013
if (PointeeRD) {
40144014
ImplicitDeallocationParameters IDP = {
4015-
typeAwareAllocation(AllowTypeAwareAllocators()),
4015+
typeAwareAllocation(AllowTypeAwareAllocatorsInCurrentContext()),
40164016
AlignedAllocation::No, SizedDeallocation::No};
40174017
if (!UseGlobal &&
40184018
FindDeallocationFunction(StartLoc, PointeeRD, DeleteName,
@@ -4066,7 +4066,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
40664066

40674067
// Look for a global declaration.
40684068
ImplicitDeallocationParameters IDP = {
4069-
typeAwareAllocation(AllowTypeAwareAllocators()),
4069+
typeAwareAllocation(AllowTypeAwareAllocatorsInCurrentContext()),
40704070
alignedAllocation(Overaligned), sizedDeallocation(CanProvideSize)};
40714071
OperatorDelete =
40724072
FindUsualDeallocationFunction(Pointee, StartLoc, IDP, DeleteName);

0 commit comments

Comments
 (0)