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 | 4871a46cc399f463da7f87ca3ec9779ddd8dc3e8 (patch) | |
tree | 79ff6ed518d9b5f13b33845f5c8703eea2407162 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 8c47bb1a029f6fb1bd823b89d1b8c25b372c93af (diff) | |
download | bcm5719-llvm-4871a46cc399f463da7f87ca3ec9779ddd8dc3e8.tar.gz bcm5719-llvm-4871a46cc399f463da7f87ca3ec9779ddd8dc3e8.zip |
Make sure we don't emit invalid IR for StmtExprs with complex cleanups.
Fixes <rdar://problem/14074868>.
llvm-svn: 183699
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index c1c252d12b7..7fb8e87cbd3 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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())); + } //===----------------------------------------------------------------------===// |