Skip to content

Commit

Permalink
Update C testcases after recent Langkit API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmderodat committed Oct 10, 2023
1 parent 0fca97c commit 0800535
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 35 deletions.
8 changes: 4 additions & 4 deletions testsuite/c_support/langkit_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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;
Expand All @@ -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");
Expand Down
7 changes: 3 additions & 4 deletions testsuite/c_support/langkit_find.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion testsuite/c_support/unicode_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/c_api/analysis_parse_no_file/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/c_api/analysis_reparse_buffer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/c_api/analysis_reparse_file/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/c_api/auto_provider/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/c_api/config_pragmas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 ();
}
}
Expand Down
7 changes: 3 additions & 4 deletions testsuite/tests/c_api/field_access/few_field_accesses.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/c_api/gpr_context/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions testsuite/tests/c_api/project_unit_provider/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -60,7 +60,7 @@ main(void)
}
if (entities->n == 0)
printf(" <nothing>\n");
ada_ada_node_array_dec_ref(entities);
ada_node_array_dec_ref(entities);

ada_context_decref(ctx);
puts("Done.");
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/c_api/property_with_args/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/c_api/short_image/tree_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/c_api/token_data/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/c_api/tree_dump/tree_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down

0 comments on commit 0800535

Please sign in to comment.