From 0800535ec936f53b90ac2945f1a80e2a80aa03a3 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Tue, 10 Oct 2023 14:10:21 +0000 Subject: [PATCH] Update C testcases after recent Langkit API changes --- testsuite/c_support/langkit_dump.h | 8 ++++---- testsuite/c_support/langkit_find.h | 7 +++---- testsuite/c_support/unicode_utils.h | 2 +- testsuite/tests/c_api/analysis_parse_no_file/main.c | 2 +- testsuite/tests/c_api/analysis_reparse_buffer/main.c | 4 ++-- testsuite/tests/c_api/analysis_reparse_file/main.c | 6 +++--- testsuite/tests/c_api/auto_provider/main.c | 2 +- testsuite/tests/c_api/config_pragmas/main.c | 6 +++--- testsuite/tests/c_api/field_access/few_field_accesses.c | 7 +++---- testsuite/tests/c_api/gpr_context/main.c | 6 +++--- testsuite/tests/c_api/project_unit_provider/main.c | 8 ++++---- testsuite/tests/c_api/property_with_args/test.c | 4 ++-- testsuite/tests/c_api/short_image/tree_dump.c | 2 +- testsuite/tests/c_api/token_data/main.c | 2 +- testsuite/tests/c_api/tree_dump/tree_dump.c | 2 +- 15 files changed, 33 insertions(+), 35 deletions(-) diff --git a/testsuite/c_support/langkit_dump.h b/testsuite/c_support/langkit_dump.h index f53c2d6a4..bf6db38cb 100644 --- a/testsuite/c_support/langkit_dump.h +++ b/testsuite/c_support/langkit_dump.h @@ -44,7 +44,7 @@ print_token(ada_token *token) } static void -dump(ada_base_entity *node, int level) +dump(ada_node *node, int level) { ada_node_kind_enum kind; ada_text kind_name; @@ -66,7 +66,7 @@ dump(ada_base_entity *node, int level) count = ada_node_children_count(node); for (i = 0; i < count; ++i) { - ada_base_entity child; + ada_node child; if (ada_node_child(node, i, &child) == 0) error("Error while getting a child"); @@ -75,7 +75,7 @@ dump(ada_base_entity *node, int level) } static void -dump_image(ada_base_entity *node, int level) +dump_image(ada_node *node, int level) { ada_text img; unsigned i, count; @@ -95,7 +95,7 @@ dump_image(ada_base_entity *node, int level) count = ada_node_children_count(node); for (i = 0; i < count; ++i) { - ada_base_entity child; + ada_node child; if (ada_node_child(node, i, &child) == 0) error("Error while getting a child"); diff --git a/testsuite/c_support/langkit_find.h b/testsuite/c_support/langkit_find.h index 8f694b6d8..cf8b59ed2 100644 --- a/testsuite/c_support/langkit_find.h +++ b/testsuite/c_support/langkit_find.h @@ -7,10 +7,9 @@ #include "libadalang.h" static void -find_node(ada_base_entity *root, ada_node_kind_enum kind, - ada_base_entity *result_p) +find_node(ada_node *root, ada_node_kind_enum kind, ada_node *result_p) { - ada_base_entity root_copy; + ada_node root_copy; unsigned i; unsigned count; @@ -23,7 +22,7 @@ find_node(ada_base_entity *root, ada_node_kind_enum kind, } for (i = 0; i < count; ++i) { - ada_base_entity child; + ada_node child; if (!ada_node_child(&root_copy, i, &child)) error("Error while getting a child"); diff --git a/testsuite/c_support/unicode_utils.h b/testsuite/c_support/unicode_utils.h index 26943af7e..43fc55352 100644 --- a/testsuite/c_support/unicode_utils.h +++ b/testsuite/c_support/unicode_utils.h @@ -34,7 +34,7 @@ static const char *src_buffer_utf_8 = ( static ada_text get_string_literal(ada_analysis_unit unit) { - ada_base_entity node; + ada_node node; ada_token tok; ada_unit_root(unit, &node); diff --git a/testsuite/tests/c_api/analysis_parse_no_file/main.c b/testsuite/tests/c_api/analysis_parse_no_file/main.c index daf320992..b71851bcf 100644 --- a/testsuite/tests/c_api/analysis_parse_no_file/main.c +++ b/testsuite/tests/c_api/analysis_parse_no_file/main.c @@ -11,7 +11,7 @@ main(void) { ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity root; + ada_node root; ctx = ada_allocate_analysis_context (); abort_on_exception (); diff --git a/testsuite/tests/c_api/analysis_reparse_buffer/main.c b/testsuite/tests/c_api/analysis_reparse_buffer/main.c index 3bf12a8c6..fae31d32c 100644 --- a/testsuite/tests/c_api/analysis_reparse_buffer/main.c +++ b/testsuite/tests/c_api/analysis_reparse_buffer/main.c @@ -28,8 +28,8 @@ const char *src_buffer_2 = ( void check(ada_analysis_unit unit) { - ada_base_entity root, prelude_list, with_clause; - ada_base_entity has_limited; + ada_node root, prelude_list, with_clause; + ada_node has_limited; if (unit == NULL) error("Could not create the analysis unit for foo.adb from a buffer"); diff --git a/testsuite/tests/c_api/analysis_reparse_file/main.c b/testsuite/tests/c_api/analysis_reparse_file/main.c index 381161040..ff8205b68 100644 --- a/testsuite/tests/c_api/analysis_reparse_file/main.c +++ b/testsuite/tests/c_api/analysis_reparse_file/main.c @@ -37,9 +37,9 @@ void write_source(const char *src_buffer) void check(ada_analysis_unit unit) { - ada_base_entity ast_root; - ada_base_entity prelude_list, with_clause; - ada_base_entity has_limited; + ada_node ast_root; + ada_node prelude_list, with_clause; + ada_node has_limited; if (unit == NULL) error("Could not create the analysis unit for foo.adb from a file"); diff --git a/testsuite/tests/c_api/auto_provider/main.c b/testsuite/tests/c_api/auto_provider/main.c index 1585eb258..a8d7c2764 100644 --- a/testsuite/tests/c_api/auto_provider/main.c +++ b/testsuite/tests/c_api/auto_provider/main.c @@ -88,7 +88,7 @@ check (const char *label, const struct unit_ref *refs, else { const char *kind_name = (kind == UNIT_BODY) ? "body" : "spec"; - ada_base_entity root; + ada_node root; ada_text image; ada_unit_root (unit, &root); diff --git a/testsuite/tests/c_api/config_pragmas/main.c b/testsuite/tests/c_api/config_pragmas/main.c index f4138e5fa..1ebc7f676 100644 --- a/testsuite/tests/c_api/config_pragmas/main.c +++ b/testsuite/tests/c_api/config_pragmas/main.c @@ -39,8 +39,8 @@ check_pragmas (ada_analysis_context ctx) { int i, j; ada_analysis_unit u; - ada_base_entity n; - ada_ada_node_array nodes; + ada_node n; + ada_node_array nodes; ada_text text; for (i = 0; i < 2; ++i) @@ -71,7 +71,7 @@ check_pragmas (ada_analysis_context ctx) abort_on_exception (); } - ada_ada_node_array_dec_ref (nodes); + ada_node_array_dec_ref (nodes); abort_on_exception (); } } diff --git a/testsuite/tests/c_api/field_access/few_field_accesses.c b/testsuite/tests/c_api/field_access/few_field_accesses.c index 853990a08..3fed80b21 100644 --- a/testsuite/tests/c_api/field_access/few_field_accesses.c +++ b/testsuite/tests/c_api/field_access/few_field_accesses.c @@ -15,12 +15,11 @@ main(void) ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity with_clause, subp_body, subp_name, has_limited, - has_private; - ada_base_entity tmp; + ada_node with_clause, subp_body, subp_name, has_limited, has_private; + ada_node tmp; ada_bool is_limited, is_private; - ada_base_entity overriding; + ada_node overriding; ada_token tok; ctx = ada_allocate_analysis_context (); diff --git a/testsuite/tests/c_api/gpr_context/main.c b/testsuite/tests/c_api/gpr_context/main.c index 3c5e25714..4b4dfe37f 100644 --- a/testsuite/tests/c_api/gpr_context/main.c +++ b/testsuite/tests/c_api/gpr_context/main.c @@ -27,8 +27,8 @@ check (const char *label, ada_token t; ada_token_kind k; ada_text text; - ada_base_entity n; - ada_ada_node_array nodes; + ada_node n; + ada_node_array nodes; int count, i; char *name; @@ -159,7 +159,7 @@ check (const char *label, abort_on_exception (); } - ada_ada_node_array_dec_ref (nodes); + ada_node_array_dec_ref (nodes); abort_on_exception (); ada_context_decref (ctx); diff --git a/testsuite/tests/c_api/project_unit_provider/main.c b/testsuite/tests/c_api/project_unit_provider/main.c index 259b42fc3..993197f76 100644 --- a/testsuite/tests/c_api/project_unit_provider/main.c +++ b/testsuite/tests/c_api/project_unit_provider/main.c @@ -17,8 +17,8 @@ main(void) uint32_t unit_name_chars[2] = { 'p', '2' }; ada_text unit_name = { unit_name_chars, 2, true }; - ada_base_entity root, subtype_ind, name; - ada_ada_node_array entities; + ada_node root, subtype_ind, name; + ada_node_array entities; ada_text text; int i; @@ -50,7 +50,7 @@ main(void) printf(" resolves to:\n"); for (i = 0; i < entities->n; ++i) { - ada_base_entity *ent = &entities->items[i]; + ada_node *ent = &entities->items[i]; printf(" "); ada_node_image(ent, &text); @@ -60,7 +60,7 @@ main(void) } if (entities->n == 0) printf(" \n"); - ada_ada_node_array_dec_ref(entities); + ada_node_array_dec_ref(entities); ada_context_decref(ctx); puts("Done."); diff --git a/testsuite/tests/c_api/property_with_args/test.c b/testsuite/tests/c_api/property_with_args/test.c index 597652e7c..663ebac5e 100644 --- a/testsuite/tests/c_api/property_with_args/test.c +++ b/testsuite/tests/c_api/property_with_args/test.c @@ -37,8 +37,8 @@ main(void) ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity foo, i; - ada_base_entity tmp; + ada_node foo, i; + ada_node tmp; ada_bool boolean; ctx = ada_allocate_analysis_context (); diff --git a/testsuite/tests/c_api/short_image/tree_dump.c b/testsuite/tests/c_api/short_image/tree_dump.c index a1a1981a0..eb29a282e 100644 --- a/testsuite/tests/c_api/short_image/tree_dump.c +++ b/testsuite/tests/c_api/short_image/tree_dump.c @@ -13,7 +13,7 @@ main(void) { ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity root; + ada_node root; ctx = ada_allocate_analysis_context (); abort_on_exception (); diff --git a/testsuite/tests/c_api/token_data/main.c b/testsuite/tests/c_api/token_data/main.c index fca5b7ada..41b42b09c 100644 --- a/testsuite/tests/c_api/token_data/main.c +++ b/testsuite/tests/c_api/token_data/main.c @@ -13,7 +13,7 @@ main(void) ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity node; + ada_node node; ada_token tok; char *tk_name; ada_text text; diff --git a/testsuite/tests/c_api/tree_dump/tree_dump.c b/testsuite/tests/c_api/tree_dump/tree_dump.c index c93c294ec..c21d8e1dd 100644 --- a/testsuite/tests/c_api/tree_dump/tree_dump.c +++ b/testsuite/tests/c_api/tree_dump/tree_dump.c @@ -13,7 +13,7 @@ main(void) { ada_analysis_context ctx; ada_analysis_unit unit; - ada_base_entity root; + ada_node root; ctx = ada_allocate_analysis_context (); abort_on_exception ();