Module: Mesa
Branch: staging/23.0
Commit: 34170edbb6b1f726c449dd498d43f90169408414
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=34170edbb6b1f726c449dd498d43f90169408414

Author: Timothy Arceri <[email protected]>
Date:   Wed Feb 15 23:13:06 2023 +1100

glsl: add _token_list_prepend() helper to the parser

This will be used in the following patch.

Cc: mesa-stable
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21352>
(cherry picked from commit 6e29dce291c45ee0460ddefb34d86b0859f5ce03)

---

 .pick_status.json                     |  2 +-
 src/compiler/glsl/glcpp/glcpp-parse.y | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4eaf8338535..dd858b2a1ac 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1039,7 +1039,7 @@
         "description": "glsl: add _token_list_prepend() helper to the parser",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y 
b/src/compiler/glsl/glcpp/glcpp-parse.y
index 7456c8ab872..e94971e5e91 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -99,6 +99,9 @@ _token_create_ival(glcpp_parser_t *parser, int type, int 
ival);
 static token_list_t *
 _token_list_create(glcpp_parser_t *parser);
 
+static void
+_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t 
*token);
+
 static void
 _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token);
 
@@ -1090,6 +1093,18 @@ _token_list_create(glcpp_parser_t *parser)
    return list;
 }
 
+void
+_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t *token)
+{
+   token_node_t *node;
+
+   node = linear_alloc_child(parser->linalloc, sizeof(token_node_t));
+   node->token = token;
+   node->next = list->head;
+
+   list->head = node;
+}
+
 void
 _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token)
 {

Reply via email to