Mesa (master): glsl: Constify the as_foo functions
Ian Romanick
idr at kemper.freedesktop.org
Wed Mar 25 17:42:16 UTC 2015
Module: Mesa
Branch: master
Commit: dec9664e35a35b447f21ea15631ae5a5404e9624
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dec9664e35a35b447f21ea15631ae5a5404e9624
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Mar 24 09:14:35 2015 -0700
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 at intel.com>
Reviewed-by: 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 0284b02..b95ba2c 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; \
}
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)
More information about the mesa-commit
mailing list