diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-10-25 00:12:49 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-10-25 00:12:49 +0000 |
commit | 465e89e094004a2ff53ba930ca0c4b41e51299ba (patch) | |
tree | 6701ebdc1fc0e77d40672277fb10c44f1d7e4579 /lib/CodeGen | |
parent | 4399890d385171eff39927a26823426046d33456 (diff) |
When we're devirtualizing a method call, make sure the method has the correct IR type.
Reported in the thread "devirtualisation appears to crash clang on covariant functions on ARM" on cfe-dev.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166651 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index fd0b362262..e05199165c 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -259,16 +259,16 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, } // Compute the function type we're calling. + const CXXMethodDecl *CalleeDecl = DevirtualizedMethod ? DevirtualizedMethod : MD; const CGFunctionInfo *FInfo = 0; - if (isa<CXXDestructorDecl>(MD)) - FInfo = &CGM.getTypes().arrangeCXXDestructor(cast<CXXDestructorDecl>(MD), + if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(CalleeDecl)) + FInfo = &CGM.getTypes().arrangeCXXDestructor(Dtor, Dtor_Complete); - else if (isa<CXXConstructorDecl>(MD)) - FInfo = &CGM.getTypes().arrangeCXXConstructorDeclaration( - cast<CXXConstructorDecl>(MD), - Ctor_Complete); + else if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(CalleeDecl)) + FInfo = &CGM.getTypes().arrangeCXXConstructorDeclaration(Ctor, + Ctor_Complete); else - FInfo = &CGM.getTypes().arrangeCXXMethodDeclaration(MD); + FInfo = &CGM.getTypes().arrangeCXXMethodDeclaration(CalleeDecl); llvm::Type *Ty = CGM.getTypes().GetFunctionType(*FInfo); |