[PATCH] Implement throw in conditional operator

David Majnemer david.majnemer at gmail.com
Tue Jun 10 14:50:59 PDT 2014


>
> +
> +  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/20140610/455ad270/attachment.html>


More information about the cfe-commits mailing list