[Mesa-dev] [PATCH 18.3/23] glsl: Constify the as_foo functions

Francisco Jerez currojerez at riseup.net
Wed Mar 25 05:21:15 PDT 2015


Ian Romanick <idr at freedesktop.org> writes:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Now that they're all implemented using macros, this is trivial.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/glsl/ir.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index ff30263..7294629 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -147,6 +147,11 @@ public:
>     {                                                    \
>        assume(this != NULL);                             \
>        return (is_##TYPE()) ? (ir_##TYPE *) this : NULL; \
> +   }                                                    \
> +   const class ir_##TYPE *as_##TYPE() const             \
> +   {                                                    \
> +      assume(this != NULL);                             \
> +      return (is_##TYPE()) ? (ir_##TYPE *) this : NULL; \

Redundant parenthesis around "is_##TYPE()" here and in the previous
patch.  With that fixed:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

>     }
>  
>     AS_BASE(rvalue)
> @@ -159,6 +164,11 @@ public:
>     { \
>        assume(this != NULL);                                         \
>        return ir_type == ir_type_##TYPE ? (ir_##TYPE *) this : NULL; \
> +   }                                                                      \
> +   const class ir_##TYPE * as_##TYPE() const                              \
> +   {                                                                      \
> +      assume(this != NULL);                                               \
> +      return ir_type == ir_type_##TYPE ? (const ir_##TYPE *) this : NULL; \
>     }
>     AS_CHILD(variable)
>     AS_CHILD(function)
> -- 
> 2.1.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150325/cd55d9a0/attachment.sig>


More information about the mesa-dev mailing list