summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser_extras.cpp
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-06-24 22:02:24 -0700
committerMatt Turner <[email protected]>2014-07-01 08:55:51 -0700
commit6e217ad1d79498a0622374d10a7eee108d470e21 (patch)
tree953c1b52833c406240ff96753bd93a28bb70683b /src/glsl/glsl_parser_extras.cpp
parent373824d7699c0316ded81edf014bc7cd8d3290f2 (diff)
glsl: Use foreach_list_typed when possible.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r--src/glsl/glsl_parser_extras.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 11a9a43208a..0d993397e40 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -844,8 +844,7 @@ ast_compound_statement::print(void) const
{
printf("{\n");
- foreach_list_const(n, &this->statements) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, &this->statements) {
ast->print();
}
@@ -924,11 +923,10 @@ ast_expression::print(void) const
subexpressions[0]->print();
printf("( ");
- foreach_list_const (n, &this->expressions) {
- if (n != this->expressions.get_head())
+ foreach_list_typed (ast_node, ast, link, &this->expressions) {
+ if (&ast->link != this->expressions.get_head())
printf(", ");
- ast_node *ast = exec_node_data(ast_node, n, link);
ast->print();
}
@@ -960,11 +958,10 @@ ast_expression::print(void) const
case ast_sequence: {
printf("( ");
- foreach_list_const(n, & this->expressions) {
- if (n != this->expressions.get_head())
+ foreach_list_typed (ast_node, ast, link, & this->expressions) {
+ if (&ast->link != this->expressions.get_head())
printf(", ");
- ast_node *ast = exec_node_data(ast_node, n, link);
ast->print();
}
printf(") ");
@@ -973,11 +970,10 @@ ast_expression::print(void) const
case ast_aggregate: {
printf("{ ");
- foreach_list_const(n, & this->expressions) {
- if (n != this->expressions.get_head())
+ foreach_list_typed (ast_node, ast, link, & this->expressions) {
+ if (&ast->link != this->expressions.get_head())
printf(", ");
- ast_node *ast = exec_node_data(ast_node, n, link);
ast->print();
}
printf("} ");
@@ -1027,8 +1023,7 @@ ast_function::print(void) const
return_type->print();
printf(" %s (", identifier);
- foreach_list_const(n, & this->parameters) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, & this->parameters) {
ast->print();
}
@@ -1105,11 +1100,10 @@ ast_declarator_list::print(void) const
else
printf("precise ");
- foreach_list_const (ptr, & this->declarations) {
- if (ptr != this->declarations.get_head())
+ foreach_list_typed (ast_node, ast, link, & this->declarations) {
+ if (&ast->link != this->declarations.get_head())
printf(", ");
- ast_node *ast = exec_node_data(ast_node, ptr, link);
ast->print();
}
@@ -1241,8 +1235,7 @@ ast_case_label::ast_case_label(ast_expression *test_value)
void ast_case_label_list::print(void) const
{
- foreach_list_const(n, & this->labels) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, & this->labels) {
ast->print();
}
printf("\n");
@@ -1257,8 +1250,7 @@ ast_case_label_list::ast_case_label_list(void)
void ast_case_statement::print(void) const
{
labels->print();
- foreach_list_const(n, & this->stmts) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, & this->stmts) {
ast->print();
printf("\n");
}
@@ -1273,8 +1265,7 @@ ast_case_statement::ast_case_statement(ast_case_label_list *labels)
void ast_case_statement_list::print(void) const
{
- foreach_list_const(n, & this->cases) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, & this->cases) {
ast->print();
}
}
@@ -1344,8 +1335,7 @@ void
ast_struct_specifier::print(void) const
{
printf("struct %s { ", name);
- foreach_list_const(n, &this->declarations) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, &this->declarations) {
ast->print();
}
printf("} ");
@@ -1456,8 +1446,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
}
if (dump_ast) {
- foreach_list_const(n, &state->translation_unit) {
- ast_node *ast = exec_node_data(ast_node, n, link);
+ foreach_list_typed(ast_node, ast, link, &state->translation_unit) {
ast->print();
}
printf("\n\n");