[clang][CodeGen] Handle throw expression in conditional operator constant folding
authorRaul Tambre <raul@tambre.ee>
Wed, 8 Apr 2020 19:05:49 +0000 (12:05 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Wed, 8 Apr 2020 19:32:21 +0000 (12:32 -0700)
commit878d96011acc0314ae7e5f87aca515286abbe4db
treeef2aab68973d0955e36b66d720f63c7db2ff8217
parent0605f5fbe755326e3dbc8daa4fc34453b8c5ac0e
[clang][CodeGen] Handle throw expression in conditional operator constant folding

Summary:
We're smart and do constant folding when emitting conditional operators.
Thus we emit the live value as a lvalue. This doesn't work if the live value is a throw expression.
Handle this by emitting the throw and returning the dead value as the lvalue.

Fixes PR28184.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77502
clang/lib/CodeGen/CGExpr.cpp
clang/test/CodeGenCXX/throw-expressions.cpp