Add CC_Win64ThisCall and set it in the necessary places.
llvm-svn: 126863
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 891697f..6acbe43 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -2582,8 +2582,11 @@
FunctionArgs.push_back(std::make_pair(Param, Param->getType()));
}
-
- StartFunction(GlobalDecl(), ResultType, Fn, FunctionArgs, SourceLocation());
+
+ const bool IsWin64 = CGM.getContext().Target.isWin64();
+
+ StartFunction(GlobalDecl(), ResultType, Fn, FunctionArgs, SourceLocation(),
+ IsWin64 ? CC_Win64ThisCall : CC_Default);
CGM.getCXXABI().EmitInstanceFunctionProlog(*this);
@@ -2614,9 +2617,14 @@
FPT->isVariadic());
llvm::Value *Callee = CGM.GetAddrOfFunction(GD, Ty, /*ForVTable=*/true);
+ FunctionType::ExtInfo Info = FPT->getExtInfo();
+
+ if (IsWin64) {
+ Info = Info.withCallingConv(CC_Win64ThisCall);
+ }
+
const CGFunctionInfo &FnInfo =
- CGM.getTypes().getFunctionInfo(ResultType, CallArgs,
- FPT->getExtInfo());
+ CGM.getTypes().getFunctionInfo(ResultType, CallArgs, Info);
// Determine whether we have a return value slot to use.
ReturnValueSlot Slot;