From 0dc736627614b476ec696fa216dd2a524d0bafad Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 4 Feb 2010 17:32:58 +0000 Subject: When binding an lvalue to a reference, we always need to pop temporaries. With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives: Expected Passes : 6933 Expected Failures : 46 Unsupported Tests : 40 Unexpected Failures: 27 which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95313 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 563db0b2be..8880701455 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -113,8 +113,16 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E, if (E->isLvalue(getContext()) == Expr::LV_Valid) { // Emit the expr as an lvalue. LValue LV = EmitLValue(E); - if (LV.isSimple()) + if (LV.isSimple()) { + if (ShouldDestroyTemporaries) { + // Pop temporaries. + while (LiveTemporaries.size() > OldNumLiveTemporaries) + PopCXXTemporary(); + } + return RValue::get(LV.getAddress()); + } + Val = EmitLoadOfLValue(LV, E->getType()); if (ShouldDestroyTemporaries) { -- cgit v1.2.3