summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index d8b8e78ebf2..0f222ae21ab 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3728,7 +3728,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
SourceLocation Loc) {
// FIXME: We no longer need the types from CallArgs; lift up and simplify.
- assert(Callee.isOrdinary());
+ assert(Callee.isOrdinary() || Callee.isVirtual());
// Handle struct-return functions by passing a pointer to the
// location that we would like to return into.
@@ -4052,7 +4052,14 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
}
}
- llvm::Value *CalleePtr = Callee.getFunctionPointer();
+ llvm::Value *CalleePtr;
+ if (Callee.isVirtual()) {
+ const CallExpr *CE = Callee.getVirtualCallExpr();
+ CalleePtr = CGM.getCXXABI().getVirtualFunctionPointer(
+ *this, Callee.getVirtualMethodDecl(), Callee.getThisAddress(),
+ Callee.getFunctionType(), CE ? CE->getLocStart() : SourceLocation());
+ } else
+ CalleePtr = Callee.getFunctionPointer();
// If we're using inalloca, set up that argument.
if (ArgMemory.isValid()) {
OpenPOWER on IntegriCloud