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 | f6c175b745604981044e399dd5a06890e70ca217 (patch) | |
tree | d6e92f185e416d184c62a7be749d4a0cae5f912c /clang/lib | |
parent | 5445f6e5b6a6959d1bb8d9a23505c035b7b92a2c (diff) | |
download | bcm5719-llvm-f6c175b745604981044e399dd5a06890e70ca217.tar.gz bcm5719-llvm-f6c175b745604981044e399dd5a06890e70ca217.zip |
Correctly handle conditional operators involving throw.
llvm-svn: 90800
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index c1cbecc9fa8..0ad139af4cd 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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"); |