@@ -5437,24 +5437,25 @@ RValue CodeGenFunction::EmitRValueForField(LValue LV,
5437
5437
// ===--------------------------------------------------------------------===//
5438
5438
5439
5439
RValue CodeGenFunction::EmitCallExpr (const CallExpr *E,
5440
- ReturnValueSlot ReturnValue) {
5440
+ ReturnValueSlot ReturnValue,
5441
+ llvm::CallBase **CallOrInvoke) {
5441
5442
// Builtins never have block type.
5442
5443
if (E->getCallee ()->getType ()->isBlockPointerType ())
5443
- return EmitBlockCallExpr (E, ReturnValue);
5444
+ return EmitBlockCallExpr (E, ReturnValue, CallOrInvoke );
5444
5445
5445
5446
if (const auto *CE = dyn_cast<CXXMemberCallExpr>(E))
5446
- return EmitCXXMemberCallExpr (CE, ReturnValue);
5447
+ return EmitCXXMemberCallExpr (CE, ReturnValue, CallOrInvoke );
5447
5448
5448
5449
if (const auto *CE = dyn_cast<CUDAKernelCallExpr>(E))
5449
- return EmitCUDAKernelCallExpr (CE, ReturnValue);
5450
+ return EmitCUDAKernelCallExpr (CE, ReturnValue, CallOrInvoke );
5450
5451
5451
5452
// A CXXOperatorCallExpr is created even for explicit object methods, but
5452
5453
// these should be treated like static function call.
5453
5454
if (const auto *CE = dyn_cast<CXXOperatorCallExpr>(E))
5454
5455
if (const auto *MD =
5455
5456
dyn_cast_if_present<CXXMethodDecl>(CE->getCalleeDecl ());
5456
5457
MD && MD->isImplicitObjectMemberFunction ())
5457
- return EmitCXXOperatorMemberCallExpr (CE, MD, ReturnValue);
5458
+ return EmitCXXOperatorMemberCallExpr (CE, MD, ReturnValue, CallOrInvoke );
5458
5459
5459
5460
CGCallee callee = EmitCallee (E->getCallee ());
5460
5461
@@ -5467,14 +5468,17 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
5467
5468
return EmitCXXPseudoDestructorExpr (callee.getPseudoDestructorExpr ());
5468
5469
}
5469
5470
5470
- return EmitCall (E->getCallee ()->getType (), callee, E, ReturnValue);
5471
+ return EmitCall (E->getCallee ()->getType (), callee, E, ReturnValue,
5472
+ /* Chain=*/ nullptr , CallOrInvoke);
5471
5473
}
5472
5474
5473
5475
// / Emit a CallExpr without considering whether it might be a subclass.
5474
5476
RValue CodeGenFunction::EmitSimpleCallExpr (const CallExpr *E,
5475
- ReturnValueSlot ReturnValue) {
5477
+ ReturnValueSlot ReturnValue,
5478
+ llvm::CallBase **CallOrInvoke) {
5476
5479
CGCallee Callee = EmitCallee (E->getCallee ());
5477
- return EmitCall (E->getCallee ()->getType (), Callee, E, ReturnValue);
5480
+ return EmitCall (E->getCallee ()->getType (), Callee, E, ReturnValue,
5481
+ /* Chain=*/ nullptr , CallOrInvoke);
5478
5482
}
5479
5483
5480
5484
// Detect the unusual situation where an inline version is shadowed by a
@@ -5678,8 +5682,9 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
5678
5682
llvm_unreachable (" bad evaluation kind" );
5679
5683
}
5680
5684
5681
- LValue CodeGenFunction::EmitCallExprLValue (const CallExpr *E) {
5682
- RValue RV = EmitCallExpr (E);
5685
+ LValue CodeGenFunction::EmitCallExprLValue (const CallExpr *E,
5686
+ llvm::CallBase **CallOrInvoke) {
5687
+ RValue RV = EmitCallExpr (E, ReturnValueSlot (), CallOrInvoke);
5683
5688
5684
5689
if (!RV.isScalar ())
5685
5690
return MakeAddrLValue (RV.getAggregateAddress (), E->getType (),
@@ -5802,9 +5807,11 @@ LValue CodeGenFunction::EmitStmtExprLValue(const StmtExpr *E) {
5802
5807
AlignmentSource::Decl);
5803
5808
}
5804
5809
5805
- RValue CodeGenFunction::EmitCall (QualType CalleeType, const CGCallee &OrigCallee,
5806
- const CallExpr *E, ReturnValueSlot ReturnValue,
5807
- llvm::Value *Chain) {
5810
+ RValue CodeGenFunction::EmitCall (QualType CalleeType,
5811
+ const CGCallee &OrigCallee, const CallExpr *E,
5812
+ ReturnValueSlot ReturnValue,
5813
+ llvm::Value *Chain,
5814
+ llvm::CallBase **CallOrInvoke) {
5808
5815
// Get the actual function type. The callee type will always be a pointer to
5809
5816
// function type or a block pointer type.
5810
5817
assert (CalleeType->isFunctionPointerType () &&
@@ -6015,8 +6022,8 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
6015
6022
Address (Handle, Handle->getType (), CGM.getPointerAlign ()));
6016
6023
Callee.setFunctionPointer (Stub);
6017
6024
}
6018
- llvm::CallBase *CallOrInvoke = nullptr ;
6019
- RValue Call = EmitCall (FnInfo, Callee, ReturnValue, Args, &CallOrInvoke ,
6025
+ llvm::CallBase *LocalCallOrInvoke = nullptr ;
6026
+ RValue Call = EmitCall (FnInfo, Callee, ReturnValue, Args, &LocalCallOrInvoke ,
6020
6027
E == MustTailCall, E->getExprLoc ());
6021
6028
6022
6029
// Generate function declaration DISuprogram in order to be used
@@ -6025,11 +6032,13 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, const CGCallee &OrigCallee
6025
6032
if (auto *CalleeDecl = dyn_cast_or_null<FunctionDecl>(TargetDecl)) {
6026
6033
FunctionArgList Args;
6027
6034
QualType ResTy = BuildFunctionArgList (CalleeDecl, Args);
6028
- DI->EmitFuncDeclForCallSite (CallOrInvoke ,
6035
+ DI->EmitFuncDeclForCallSite (LocalCallOrInvoke ,
6029
6036
DI->getFunctionType (CalleeDecl, ResTy, Args),
6030
6037
CalleeDecl);
6031
6038
}
6032
6039
}
6040
+ if (CallOrInvoke)
6041
+ *CallOrInvoke = LocalCallOrInvoke;
6033
6042
6034
6043
return Call;
6035
6044
}
0 commit comments