[cfe-commits] [PATCH] Use ExprResult& instead of Expr *& in Sema

John Wiegley johnw at boostpro.com
Fri Mar 4 20:01:19 PST 2011


John Wiegley <johnw at boostpro.com> writes:

> This patch authored by Eric Niebler.
>
> Many methods on the Sema class (e.g. ConvertPropertyForRValue) take Expr
> pointers as in/out parameters (Expr *&).  This is especially true for the
> routines that apply implicit conversions to nodes in-place.  This design is
> workable only as long as those conversions cannot fail.  If they are allowed
> to fail, they need a way to report their failures.  The typical way of doing
> this in clang is to use an ExprResult, which has an extra bit to signal a
> valid/invalid state.  Returning ExprResult is de riguour elsewhere in the Sema
> interface.  We suggest changing the Expr *& parameters in the Sema interface
> to ExprResult &.  This increases interface consistency and maintainability.

I have updated this patch to include a few corrections from Eric, and also
resolved some merge conflicts with very recent changes in Subversion.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-ExprResult-instead-of-Expr-in-Sema.patch
Type: text/x-patch
Size: 285535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110304/23b9c73a/attachment.bin>


More information about the cfe-commits mailing list