}
llvm::Constant *CodeGenModule::GetAddrOfThunk(GlobalDecl GD,
- const ThunkInfo &Thunk) {
+ const ThunkInfo &Thunk,
+ bool ForVTable) {
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
// Compute the mangled name.
getCXXABI().getMangleContext().mangleThunk(MD, Thunk, Name);
const llvm::Type *Ty = getTypes().GetFunctionTypeForVTable(GD);
- return GetOrCreateLLVMFunction(Name, Ty, GD, /*ForVTable=*/false);
+ return GetOrCreateLLVMFunction(Name, Ty, GD, ForVTable);
}
static llvm::Value *PerformTypeAdjustment(CodeGenFunction &CGF,
void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk)
{
- llvm::Constant *Entry = CGM.GetAddrOfThunk(GD, Thunk);
+ llvm::Constant *Entry = CGM.GetAddrOfThunk(GD, Thunk, /*ForVTable=*/false);
// Strip off a bitcast if we got one back.
if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(Entry)) {
// Remove the name from the old thunk function and get a new thunk.
OldThunkFn->setName(llvm::StringRef());
- Entry = CGM.GetAddrOfThunk(GD, Thunk);
+ Entry = CGM.GetAddrOfThunk(GD, Thunk, /*ForVTable=*/false);
// If needed, replace the old thunk with a bitcast.
if (!OldThunkFn->use_empty()) {
VTableThunks[NextVTableThunkIndex].first == I) {
const ThunkInfo &Thunk = VTableThunks[NextVTableThunkIndex].second;
- Init = CGM.GetAddrOfThunk(GD, Thunk);
+ Init = CGM.GetAddrOfThunk(GD, Thunk, /*ForVTable=*/true);
NextVTableThunkIndex++;
} else {
llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH = false);
/// GetAddrOfThunk - Get the address of the thunk for the given global decl.
- llvm::Constant *GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk);
+ llvm::Constant *GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk,
+ bool ForVTable);
/// GetWeakRefReference - Get a reference to the target of VD.
llvm::Constant *GetWeakRefReference(const ValueDecl *VD);