aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXXTemp.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-14 01:10:45 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-14 01:10:45 +0000
commitb9ea0b53d323cdca2b8284ff986a878e195cb97f (patch)
tree6240c6359e8c81c9e17302cd7b898de75f79b6cd /lib/CodeGen/CGCXXTemp.cpp
parent16a0808b7992db2c2ba78b387e1732bbb0fb371b (diff)
Implement CodeGenFunction::EmitCXXExprWithTemporariesLValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81738 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXXTemp.cpp')
-rw-r--r--lib/CodeGen/CGCXXTemp.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXXTemp.cpp b/lib/CodeGen/CGCXXTemp.cpp
index fbb2b9f719..177c6db3e8 100644
--- a/lib/CodeGen/CGCXXTemp.cpp
+++ b/lib/CodeGen/CGCXXTemp.cpp
@@ -111,6 +111,31 @@ CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
return RV;
}
+LValue CodeGenFunction::EmitCXXExprWithTemporariesLValue(
+ const CXXExprWithTemporaries *E) {
+ // If we shouldn't destroy the temporaries, just emit the
+ // child expression.
+ if (!E->shouldDestroyTemporaries())
+ return EmitLValue(E->getSubExpr());
+
+ // Keep track of the current cleanup stack depth.
+ size_t CleanupStackDepth = CleanupEntries.size();
+ (void) CleanupStackDepth;
+
+ unsigned OldNumLiveTemporaries = LiveTemporaries.size();
+
+ LValue LV = EmitLValue(E->getSubExpr());
+
+ // Pop temporaries.
+ while (LiveTemporaries.size() > OldNumLiveTemporaries)
+ PopCXXTemporary();
+
+ assert(CleanupEntries.size() == CleanupStackDepth &&
+ "Cleanup size mismatch!");
+
+ return LV;
+}
+
void
CodeGenFunction::PushConditionalTempDestruction() {
// Store the current number of live temporaries.