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 | ade609770e7534fcd69d93923dd8098bee1cfb7d (patch) | |
tree | a4634ea8c0ab82948d9ad124ed7a4e4deda0cf0b /clang/lib/CodeGen | |
parent | d02437c902be95ae0e8c223560cf7bcb4730683e (diff) | |
download | bcm5719-llvm-ade609770e7534fcd69d93923dd8098bee1cfb7d.tar.gz bcm5719-llvm-ade609770e7534fcd69d93923dd8098bee1cfb7d.zip |
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.
llvm-svn: 166651
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index fd0b3622620..e05199165c1 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/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); |