diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-05-03 20:00:27 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-05-03 20:00:27 +0000 |
| commit | aee1f514854c59f3890a97f23dccbf2be21d06e1 (patch) | |
| tree | cbaf20935aecbc5073eb8bcdbc14f5305bec5de2 /clang/lib | |
| parent | 937a5b75f905e7602654ef4297689ec26c9e3517 (diff) | |
| download | bcm5719-llvm-aee1f514854c59f3890a97f23dccbf2be21d06e1.tar.gz bcm5719-llvm-aee1f514854c59f3890a97f23dccbf2be21d06e1.zip | |
If we're generating code to create a pointer-to-member function
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.
llvm-svn: 102942
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index d2f75bd3552..d1b0dff11e5 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -321,6 +321,11 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) { (void) MPT; assert(MPT->getPointeeType()->isFunctionProtoType() && "Unexpected member pointer type!"); + + // The creation of member function pointers has no side effects; if + // there is no destination pointer, we have nothing to do. + if (!DestPtr) + return; const DeclRefExpr *DRE = cast<DeclRefExpr>(E->getSubExpr()); const CXXMethodDecl *MD = @@ -329,6 +334,7 @@ void AggExprEmitter::VisitUnaryAddrOf(const UnaryOperator *E) { const llvm::Type *PtrDiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); + llvm::Value *DstPtr = Builder.CreateStructGEP(DestPtr, 0, "dst.ptr"); llvm::Value *FuncPtr; |

