Mesa (glsl2): glsl2: Initialize ir_instruction::type and ir_rvalue::type.
Kenneth Graunke
kwg at kemper.freedesktop.org
Thu Jul 22 23:47:48 UTC 2010
Module: Mesa
Branch: glsl2
Commit: 0a89175a35ba3ac2a94d0ba9bcc9926edc8927e3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a89175a35ba3ac2a94d0ba9bcc9926edc8927e3
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Thu Jul 22 16:45:37 2010 -0700
glsl2: Initialize ir_instruction::type and ir_rvalue::type.
Top-level instructions now get NULL as their default type (since type is
irrelevant for things like ir_function), while ir_rvalues get error_type
by default.
This should make it easier to tell if we've forgotten to set a type. It
also fixes some "Conditional jump or move depends on uninitialized
value" errors in valgrind caused by ir_validate examining the type of
top level ir_instructions, which weren't set.
---
src/glsl/ir.cpp | 5 +++++
src/glsl/ir.h | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 5054ec7..8ebef7d 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -26,6 +26,11 @@
#include "ir_visitor.h"
#include "glsl_types.h"
+ir_rvalue::ir_rvalue()
+{
+ this->type = glsl_type::error_type;
+}
+
ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
ir_rvalue *condition)
{
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 3fd3a76..e0f3683 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -106,6 +106,7 @@ protected:
ir_instruction()
{
ir_type = ir_type_unset;
+ type = NULL;
}
};
@@ -150,10 +151,7 @@ public:
}
protected:
- ir_rvalue()
- {
- /* empty */
- }
+ ir_rvalue();
};
More information about the mesa-commit
mailing list