@@ -5443,24 +5443,25 @@ RValue CodeGenFunction::EmitRValueForField(LValue LV,
5443
5443
// ===--------------------------------------------------------------------===//
5444
5444
5445
5445
RValue CodeGenFunction::EmitCallExpr (const CallExpr *E,
5446
- ReturnValueSlot ReturnValue) {
5446
+ ReturnValueSlot ReturnValue,
5447
+ llvm::CallBase **CallOrInvoke) {
5447
5448
// Builtins never have block type.
5448
5449
if (E->getCallee ()->getType ()->isBlockPointerType ())
5449
- return EmitBlockCallExpr (E, ReturnValue);
5450
+ return EmitBlockCallExpr (E, ReturnValue, CallOrInvoke );
5450
5451
5451
5452
if (const auto *CE = dyn_cast<CXXMemberCallExpr>(E))
5452
- return EmitCXXMemberCallExpr (CE, ReturnValue);
5453
+ return EmitCXXMemberCallExpr (CE, ReturnValue, CallOrInvoke );
5453
5454
5454
5455
if (const auto *CE = dyn_cast<CUDAKernelCallExpr>(E))
5455
- return EmitCUDAKernelCallExpr (CE, ReturnValue);
5456
+ return EmitCUDAKernelCallExpr (CE, ReturnValue, CallOrInvoke );
5456
5457
5457
5458
// A CXXOperatorCallExpr is created even for explicit object methods, but
5458
5459
// these should be treated like static function call.
5459
5460
if (const auto *CE = dyn_cast<CXXOperatorCallExpr>(E))
5460
5461
if (const auto *MD =
5461
5462
dyn_cast_if_present<CXXMethodDecl>(CE->getCalleeDecl ());
5462
5463
MD && MD->isImplicitObjectMemberFunction ())
5463
- return EmitCXXOperatorMemberCallExpr (CE, MD, ReturnValue);
5464
+ return EmitCXXOperatorMemberCallExpr (CE, MD, ReturnValue, CallOrInvoke );
5464
5465
5465
5466
CGCallee callee = EmitCallee (E->getCallee ());
5466
5467
@@ -5473,14 +5474,17 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
5473
5474
return EmitCXXPseudoDestructorExpr (callee.getPseudoDestructorExpr ());
5474
5475
}
5475
5476
5476
- return EmitCall (E->getCallee ()->getType (), callee, E, ReturnValue);
5477
+ return EmitCall (E->getCallee ()->getType (), callee, E, ReturnValue,
5478
+ /* Chain=*/ nullptr , CallOrInvoke);
5477
5479
}
5478
5480
5479
5481
// / Emit a CallExpr without considering whether it might be a subclass.
5480
5482
RValue CodeGenFunction::EmitSimpleCallExpr (const CallExpr *E,
5481
- ReturnValueSlot ReturnValue) {
5483
+ ReturnValueSlot ReturnValue,
5484
+ llvm::CallBase **CallOrInvoke) {
5482
5485
CGCallee Callee = EmitCallee (E->getCallee ());
5483
- return EmitCall (E->getCallee ()->getType (), Callee, E, ReturnValue);
5486
+ return EmitCall (E->getCallee ()->getType (), Callee, E, ReturnValue,
5487
+ /* Chain=*/ nullptr , CallOrInvoke);
5484
5488
}
5485
5489
5486
5490
// Detect the unusual situation where an inline version is shadowed by a
@@ -5684,8 +5688,9 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
5684
5688
llvm_unreachable (" bad evaluation kind" );
5685
5689
}
5686
5690
5687
- LValue CodeGenFunction::EmitCallExprLValue (const CallExpr *E) {
5688
- RValue RV = EmitCallExpr (E);
5691
+ LValue CodeGenFunction::EmitCallExprLValue (const CallExpr *E,
5692
+ llvm::CallBase **CallOrInvoke) {
5693
+ RValue RV = EmitCallExpr (E, ReturnValueSlot (), CallOrInvoke);
5689
5694
5690
5695
if (!RV.isScalar ())
5691
5696
return MakeAddrLValue (RV.getAggregateAddress (), E->getType (),
@@ -5808,9 +5813,11 @@ LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {
5808
5813
AlignmentSource::Decl);
5809
5814
}
5810
5815
5811
- RValue CodeGenFunction::EmitCall (QualType CalleeType, const CGCallee &OrigCallee,
5812
- const CallExpr *E, ReturnValueSlot ReturnValue,
5813
- llvm::Value *Chain) {
5816
+ RValue CodeGenFunction::EmitCall (QualType CalleeType,
5817
+ const CGCallee &OrigCallee, const CallExpr *E,
5818
+ ReturnValueSlot ReturnValue,
5819
+ llvm::Value *Chain,
5820
+ llvm::CallBase **CallOrInvoke) {
5814
5821
// Get the actual function type. The callee type will always be a pointer to
5815
5822
// function type or a block pointer type.
5816
5823
assert (CalleeType->isFunctionPointerType () &&
@@ -6030,8 +6037,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
6030
6037
Address (Handle, Handle->getType (), CGM.getPointerAlign ()));
6031
6038
Callee.setFunctionPointer (Stub);
6032
6039
}
6033
- llvm::CallBase *CallOrInvoke = nullptr ;
6034
- RValue Call = EmitCall (FnInfo, Callee, ReturnValue, Args, &CallOrInvoke ,
6040
+ llvm::CallBase *LocalCallOrInvoke = nullptr ;
6041
+ RValue Call = EmitCall (FnInfo, Callee, ReturnValue, Args, &LocalCallOrInvoke ,
6035
6042
E == MustTailCall, E->getExprLoc ());
6036
6043
6037
6044
// Generate function declaration DISuprogram in order to be used
@@ -6040,11 +6047,13 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
6040
6047
if (auto *CalleeDecl = dyn_cast_or_null<FunctionDecl>(TargetDecl)) {
6041
6048
FunctionArgList Args;
6042
6049
QualType ResTy = BuildFunctionArgList (CalleeDecl, Args);
6043
- DI->EmitFuncDeclForCallSite (CallOrInvoke ,
6050
+ DI->EmitFuncDeclForCallSite (LocalCallOrInvoke ,
6044
6051
DI->getFunctionType (CalleeDecl, ResTy, Args),
6045
6052
CalleeDecl);
6046
6053
}
6047
6054
}
6055
+ if (CallOrInvoke)
6056
+ *CallOrInvoke = LocalCallOrInvoke;
6048
6057
6049
6058
return Call;
6050
6059
}
0 commit comments