@@ -1424,33 +1424,34 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
14241424 ImplicitAllocationParameters IAP = {
14251425 typeAwareAllocationModeFromBool (S.getLangOpts ().TypeAwareAllocators ),
14261426 alignedAllocationModeFromBool (S.getLangOpts ().CoroAlignedAllocation )};
1427- auto LookupAllocationFunction =
1428- [&](Sema::AllocationFunctionScope NewScope = Sema::AFS_Both,
1429- bool WithoutPlacementArgs = false , bool ForceNonAligned = false ) {
1430- // [dcl.fct.def.coroutine]p9
1431- // The allocation function's name is looked up by searching for it in
1432- // the
1433- // scope of the promise type.
1434- // - If any declarations are found, ...
1435- // - If no declarations are found in the scope of the promise type, a
1436- // search is performed in the global scope.
1437- if (NewScope == Sema::AFS_Both)
1438- NewScope = PromiseContainsNew ? Sema::AFS_Class : Sema::AFS_Global;
1439-
1440- bool ShouldUseAlignedAlloc = !ForceNonAligned && S.getLangOpts ().CoroAlignedAllocation ;
1441- IAP = {
1442- typeAwareAllocationModeFromBool (S.getLangOpts ().TypeAwareAllocators ),
1443- alignedAllocationModeFromBool (ShouldUseAlignedAlloc)};
1444-
1445- FunctionDecl *UnusedResult = nullptr ;
1446-
1447- S.FindAllocationFunctions (
1448- Loc, SourceRange (), NewScope,
1449- /* DeleteScope*/ Sema::AFS_Both, PromiseType,
1450- /* isArray*/ false , IAP,
1451- WithoutPlacementArgs ? MultiExprArg{} : PlacementArgs, OperatorNew,
1452- UnusedResult, /* Diagnose*/ false );
1453- };
1427+ auto LookupAllocationFunction = [&](Sema::AllocationFunctionScope NewScope =
1428+ Sema::AFS_Both,
1429+ bool WithoutPlacementArgs = false ,
1430+ bool ForceNonAligned = false ) {
1431+ // [dcl.fct.def.coroutine]p9
1432+ // The allocation function's name is looked up by searching for it in
1433+ // the
1434+ // scope of the promise type.
1435+ // - If any declarations are found, ...
1436+ // - If no declarations are found in the scope of the promise type, a
1437+ // search is performed in the global scope.
1438+ if (NewScope == Sema::AFS_Both)
1439+ NewScope = PromiseContainsNew ? Sema::AFS_Class : Sema::AFS_Global;
1440+
1441+ bool ShouldUseAlignedAlloc =
1442+ !ForceNonAligned && S.getLangOpts ().CoroAlignedAllocation ;
1443+ IAP = {typeAwareAllocationModeFromBool (S.getLangOpts ().TypeAwareAllocators ),
1444+ alignedAllocationModeFromBool (ShouldUseAlignedAlloc)};
1445+
1446+ FunctionDecl *UnusedResult = nullptr ;
1447+
1448+ S.FindAllocationFunctions (Loc, SourceRange (), NewScope,
1449+ /* DeleteScope*/ Sema::AFS_Both, PromiseType,
1450+ /* isArray*/ false , IAP,
1451+ WithoutPlacementArgs ? MultiExprArg{}
1452+ : PlacementArgs,
1453+ OperatorNew, UnusedResult, /* Diagnose*/ false );
1454+ };
14541455
14551456 // We don't expect to call to global operator new with (size, p0, …, pn).
14561457 // So if we choose to lookup the allocation function in global scope, we
0 commit comments