aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index f788f62f6f..3895e75b8e 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -489,11 +489,17 @@ CodeGenModule::GetAddrOfCovariantThunk(GlobalDecl GD,
}
void CodeGenModule::BuildThunksForVirtual(GlobalDecl GD) {
+ const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
+
+ if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(MD))
+ GD = GlobalDecl(DD, GD.getDtorType());
+ else
+ GD = MD->getCanonicalDecl();
+
CodeGenVTables::AdjustmentVectorTy *AdjPtr = getVTables().getAdjustments(GD);
if (!AdjPtr)
return;
CodeGenVTables::AdjustmentVectorTy &Adj = *AdjPtr;
- const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
for (unsigned i = 0; i < Adj.size(); i++) {
GlobalDecl OGD = Adj[i].first;
const CXXMethodDecl *OMD = cast<CXXMethodDecl>(OGD.getDecl());