aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-07-02 13:28:32 -0700
committerIan Romanick <[email protected]>2010-07-12 15:19:29 -0700
commitdf05ad4e1aa5512ce1dfd2e6661641e012c8b279 (patch)
tree180505b3ac0c1f36fb6e16a6db344c882c306c8b /src/glsl
parentf3235eb37f264244f4ea432700be7dd6b2930d6c (diff)
ir_function_signature: Add method to get the function owning a signature
There is no setter function, the getter returns a constant pointer, and ir_function_signature::_function is private for a reason. The only way to make a connection between a function and function signature is via ir_function::add_signature. This helps ensure that certain invariants (i.e., a function signature is in the list of signatures for its _function) are met.
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir.cpp2
-rw-r--r--src/glsl/ir.h25
2 files changed, 22 insertions, 5 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index f3ee12ce81f..6d899132861 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -771,7 +771,7 @@ ir_variable::component_slots() const
ir_function_signature::ir_function_signature(const glsl_type *return_type)
- : return_type(return_type), is_defined(false)
+ : return_type(return_type), is_defined(false), _function(NULL)
{
/* empty */
}
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 18294ebc314..fb94b5a560d 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -276,6 +276,23 @@ public:
const char *function_name() const;
/**
+ * Get a handle to the function for which this is a signature
+ *
+ * There is no setter function, this function returns a \c const pointer,
+ * and \c ir_function_signature::_function is private for a reason. The
+ * only way to make a connection between a function and function signature
+ * is via \c ir_function::add_signature. This helps ensure that certain
+ * invariants (i.e., a function signature is in the list of signatures for
+ * its \c _function) are met.
+ *
+ * \sa ir_function::add_signature
+ */
+ inline const class ir_function *function() const
+ {
+ return this->_function;
+ }
+
+ /**
* Check whether the qualifiers match between this signature's parameters
* and the supplied parameter list. If not, returns the name of the first
* parameter with mismatched qualifiers (for use in error messages).
@@ -312,7 +329,7 @@ public:
private:
/** Function of which this signature is one overload. */
- class ir_function *function;
+ class ir_function *_function;
friend class ir_function;
};
@@ -343,8 +360,8 @@ public:
void add_signature(ir_function_signature *sig)
{
- sig->function = this;
- signatures.push_tail(sig);
+ sig->_function = this;
+ this->signatures.push_tail(sig);
}
/**
@@ -381,7 +398,7 @@ private:
inline const char *ir_function_signature::function_name() const
{
- return function->name;
+ return this->_function->name;
}
/*@}*/