diff options
author | Anders Carlsson <andersca@mac.com> | 2010-01-05 05:04:05 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-01-05 05:04:05 +0000 |
commit | a0b025e40f94ceffcc8f197d9c15d0f5ade65d96 (patch) | |
tree | be4f42fe27ad4be63a4289fca003b3bc018606a1 /clang/lib | |
parent | f741d72b8492daf5569508d1feabc25400d71afc (diff) | |
download | bcm5719-llvm-a0b025e40f94ceffcc8f197d9c15d0f5ade65d96.tar.gz bcm5719-llvm-a0b025e40f94ceffcc8f197d9c15d0f5ade65d96.zip |
When emitting member function pointers, use the canonical decl if the member function is virtual. Fixes PR5940.
llvm-svn: 92680
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index b95fd799010..c852d65b859 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -313,7 +313,8 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) { "Unexpected member pointer type!"); const DeclRefExpr *DRE = cast<DeclRefExpr>(E->getSubExpr()); - const CXXMethodDecl *MD = cast<CXXMethodDecl>(DRE->getDecl()); + const CXXMethodDecl *MD = + cast<CXXMethodDecl>(DRE->getDecl())->getCanonicalDecl(); const llvm::Type *PtrDiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 3236d3950e5..d1330e066de 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -408,6 +408,8 @@ public: llvm::Constant *EmitMemberFunctionPointer(CXXMethodDecl *MD) { assert(MD->isInstance() && "Member function must not be static!"); + MD = MD->getCanonicalDecl(); + const llvm::Type *PtrDiffTy = CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType()); |