diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-12-07 20:25:53 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-12-07 20:25:53 +0000 |
commit | 48daf59c9f52856ca80074f1f5a30aa29c235726 (patch) | |
tree | 59b0396f74adb90383575f6d45b21947eeade432 /lib | |
parent | 130c69e969a785ff3be9e909f8eba7f89e42ac10 (diff) |
Correctly handle conditional operators involving throw.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index c1cbecc9fa..0ad139af4c 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1868,10 +1868,11 @@ VisitConditionalOperator(const ConditionalOperator *E) { CGF.EmitBlock(ContBlock); - if (!LHS || !RHS) { - assert(E->getType()->isVoidType() && "Non-void value should have a value"); - return 0; - } + // If the LHS or RHS is a throw expression, it will be legitimately null. + if (!LHS) + return RHS; + if (!RHS) + return LHS; // Create a PHI node for the real part. llvm::PHINode *PN = Builder.CreatePHI(LHS->getType(), "cond"); |