aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXXTemp.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-08-16 07:36:22 +0000
committerAnders Carlsson <andersca@mac.com>2009-08-16 07:36:22 +0000
commit14c5cbf59cffee52275230922283a247de407712 (patch)
treeea9e1adf02b4ddb7905f369acb8ceae2480f1f30 /lib/CodeGen/CGCXXTemp.cpp
parent5add6835b0c6b0f67e19fd5366825d3e41eb0dcf (diff)
Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXXTemp.cpp')
-rw-r--r--lib/CodeGen/CGCXXTemp.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCXXTemp.cpp b/lib/CodeGen/CGCXXTemp.cpp
index 04d3842daa..30de1115c0 100644
--- a/lib/CodeGen/CGCXXTemp.cpp
+++ b/lib/CodeGen/CGCXXTemp.cpp
@@ -84,11 +84,13 @@ void CodeGenFunction::PopCXXTemporary() {
RValue
CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
llvm::Value *AggLoc,
- bool isAggLocVolatile) {
+ bool IsAggLocVolatile,
+ bool IsInitializer) {
// If we shouldn't destroy the temporaries, just emit the
// child expression.
if (!E->shouldDestroyTemporaries())
- return EmitAnyExpr(E->getSubExpr(), AggLoc, isAggLocVolatile);
+ return EmitAnyExpr(E->getSubExpr(), AggLoc, IsAggLocVolatile,
+ /*IgnoreResult=*/false, IsInitializer);
// Keep track of the current cleanup stack depth.
size_t CleanupStackDepth = CleanupEntries.size();
@@ -96,7 +98,8 @@ CodeGenFunction::EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E,
unsigned OldNumLiveTemporaries = LiveTemporaries.size();
- RValue RV = EmitAnyExpr(E->getSubExpr(), AggLoc, isAggLocVolatile);
+ RValue RV = EmitAnyExpr(E->getSubExpr(), AggLoc, IsAggLocVolatile,
+ /*IgnoreResult=*/false, IsInitializer);
// Pop temporaries.
while (LiveTemporaries.size() > OldNumLiveTemporaries)