glsl: Constify the as_foo functions
Now that they're all implemented using macros, this is trivial. v2: Remove redundant parenthesis. Suggested by Curro. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
This commit is contained in:
@@ -144,6 +144,11 @@ public:
|
|||||||
/*@{*/
|
/*@{*/
|
||||||
#define AS_BASE(TYPE) \
|
#define AS_BASE(TYPE) \
|
||||||
class ir_##TYPE *as_##TYPE() \
|
class ir_##TYPE *as_##TYPE() \
|
||||||
|
{ \
|
||||||
|
assume(this != NULL); \
|
||||||
|
return is_##TYPE() ? (ir_##TYPE *) this : NULL; \
|
||||||
|
} \
|
||||||
|
const class ir_##TYPE *as_##TYPE() const \
|
||||||
{ \
|
{ \
|
||||||
assume(this != NULL); \
|
assume(this != NULL); \
|
||||||
return is_##TYPE() ? (ir_##TYPE *) this : NULL; \
|
return is_##TYPE() ? (ir_##TYPE *) this : NULL; \
|
||||||
@@ -159,6 +164,11 @@ public:
|
|||||||
{ \
|
{ \
|
||||||
assume(this != NULL); \
|
assume(this != NULL); \
|
||||||
return ir_type == ir_type_##TYPE ? (ir_##TYPE *) 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(variable)
|
||||||
AS_CHILD(function)
|
AS_CHILD(function)
|
||||||
|
Reference in New Issue
Block a user