[PATCH] Implement throw in conditional operator

Marius Wachtler undingen at gmail.com
Tue Jun 10 15:01:34 PDT 2014


Hi
Attached you can find an updates patch.




On Tue, Jun 10, 2014 at 11:50 PM, David Majnemer <david.majnemer at gmail.com>
wrote:

> +
>> +  case Expr::CXXThrowExprClass: {
>> +    const auto* throwExpr = cast<CXXThrowExpr>(E);
>>
>
> Please stick the star on the RHS. Also, it is customary in LLVM and clang
> to spell it like "ThrowExpr"
>
>
>> +    EmitCXXThrowExpr(throwExpr);
>> +    const QualType subExprType = throwExpr->getSubExpr()->getType();
>>
>
> Likewise for "subExprType"
>
> +    llvm::Type *Ty =
>> llvm::PointerType::getUnqual(ConvertType(subExprType));
>> +    return MakeAddrLValue(llvm::UndefValue::get(Ty), subExprType);
>>    }
>
>
>
> On Tue, Jun 10, 2014 at 5:19 PM, Marius Wachtler <undingen at gmail.com>
> wrote:
>
>> Hello
>>
>> Attached you can find my first clang patch which should implement
>> "cond ? throw 1 : val".
>>
>> Without this patch I get: "cannot compile this l-value expression yet"
>>
>> As this is my first time looking under the hood of clang I'm not sure if
>> this is the right approach. I'm Looking forward to your feedback.
>>
>> - Marius Wachtler
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/629c4ad0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cond_op_throw.patch
Type: text/x-patch
Size: 1405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/629c4ad0/attachment.bin>


More information about the cfe-commits mailing list