diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2013-06-10 22:04:49 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2013-06-10 22:04:49 +0000 |
| commit | 2ac2fa7726eb2f6fe445e098489e92931c31f7ca (patch) | |
| tree | 570cb17a18d3678b9d7a35db74c040a679db720c /lib/CodeGen/CGExprScalar.cpp | |
| parent | 7044668ecb518496e463ea2dacae100d4badfd19 (diff) | |
| download | clang-2ac2fa7726eb2f6fe445e098489e92931c31f7ca.tar.gz clang-2ac2fa7726eb2f6fe445e098489e92931c31f7ca.tar.bz2 clang-2ac2fa7726eb2f6fe445e098489e92931c31f7ca.tar.xz | |
Make sure we don't emit invalid IR for StmtExprs with complex cleanups.
Fixes <rdar://problem/14074868>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index c1c252d12b..7fb8e87cbd 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1442,8 +1442,12 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { Value *ScalarExprEmitter::VisitStmtExpr(const StmtExpr *E) { CodeGenFunction::StmtExprEvaluation eval(CGF); - return CGF.EmitCompoundStmt(*E->getSubStmt(), !E->getType()->isVoidType()) - .getScalarVal(); + llvm::Value *RetAlloca = CGF.EmitCompoundStmt(*E->getSubStmt(), + !E->getType()->isVoidType()); + if (!RetAlloca) + return 0; + return CGF.EmitLoadOfScalar(CGF.MakeAddrLValue(RetAlloca, E->getType())); + } //===----------------------------------------------------------------------===// |
