Skip to content

Commit 201ca90

Browse files
Merge pull request #100 from GuillaumeGomez/missing-casts
Add missing `*_to_object` casts
2 parents 3498409 + 0c5338e commit 201ca90

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

gcc/jit/libgccjit.cc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,20 @@ gcc_jit_vector_type_get_num_units (gcc_jit_vector_type *vector_type)
699699
return vector_type->get_num_units ();
700700
}
701701

702+
/* Public entrypoint. See description in libgccjit.h.
703+
704+
After error-checking, this calls the trivial
705+
gcc::jit::recording::memento::as_object method (a type is a
706+
memento), in jit-recording.h. */
707+
708+
gcc_jit_object *
709+
gcc_jit_vector_type_as_object (gcc_jit_vector_type *vector_type)
710+
{
711+
RETURN_NULL_IF_FAIL (vector_type, NULL, NULL, "NULL vector_type");
712+
713+
return static_cast <gcc_jit_object *> (vector_type->as_object ());
714+
}
715+
702716
/* Public entrypoint. See description in libgccjit.h.
703717
704718
After error-checking, the real work is done by the
@@ -824,6 +838,20 @@ gcc_jit_function_type_get_param_type (gcc_jit_function_type *function_type,
824838
return (gcc_jit_type *)function_type->get_param_types ()[index];
825839
}
826840

841+
/* Public entrypoint. See description in libgccjit.h.
842+
843+
After error-checking, this calls the trivial
844+
gcc::jit::recording::memento::as_object method (a type is a
845+
memento), in jit-recording.h. */
846+
847+
gcc_jit_object *
848+
gcc_jit_function_type_as_object (gcc_jit_function_type *function_type)
849+
{
850+
RETURN_NULL_IF_FAIL (function_type, NULL, NULL, "NULL function_type");
851+
852+
return static_cast <gcc_jit_object *> (function_type->as_object ());
853+
}
854+
827855
/* Public entrypoint. See description in libgccjit.h.
828856
829857
After error-checking, the real work is done by the
@@ -3229,6 +3257,20 @@ gcc_jit_region_add_block (gcc_jit_region *region, gcc_jit_block *block)
32293257
region->add_block (block);
32303258
}
32313259

3260+
/* Public entrypoint. See description in libgccjit.h.
3261+
3262+
After error-checking, this calls the trivial
3263+
gcc::jit::recording::memento::as_object method (a region is a
3264+
memento), in jit-recording.h. */
3265+
3266+
gcc_jit_object *
3267+
gcc_jit_region_as_object (gcc_jit_region *region)
3268+
{
3269+
RETURN_NULL_IF_FAIL (region, NULL, NULL, "NULL region");
3270+
3271+
return static_cast <gcc_jit_object *> (region->as_object ());
3272+
}
3273+
32323274
/* Public entrypoint. See description in libgccjit.h.
32333275
32343276
After error-checking, the real work is done by the

gcc/jit/libgccjit.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,14 @@ extern void
16101610
gcc_jit_region_add_block (gcc_jit_region *region,
16111611
gcc_jit_block *block);
16121612

1613+
/* Upcasting from gcc_jit_region to object.
1614+
1615+
This API entrypoint was added in LIBGCCJIT_ABI_55.
1616+
*/
1617+
1618+
extern gcc_jit_object *
1619+
gcc_jit_region_as_object (gcc_jit_region *region);
1620+
16131621
#define LIBGCCJIT_HAVE_REGION
16141622

16151623
/* Clone blocks into out_clones.
@@ -2248,6 +2256,14 @@ extern gcc_jit_type *
22482256
gcc_jit_function_type_get_param_type (gcc_jit_function_type *function_type,
22492257
size_t index);
22502258

2259+
/* Upcasting from gcc_jit_function_type to object.
2260+
2261+
This API entrypoint was added in LIBGCCJIT_ABI_55.
2262+
*/
2263+
2264+
extern gcc_jit_object *
2265+
gcc_jit_function_type_as_object (gcc_jit_function_type *function_type);
2266+
22512267
/* Return non-zero if the type is an integral. */
22522268
extern int
22532269
gcc_jit_type_is_integral (gcc_jit_type *type);
@@ -2279,6 +2295,14 @@ gcc_jit_vector_type_get_num_units (gcc_jit_vector_type *vector_type);
22792295
extern gcc_jit_type *
22802296
gcc_jit_vector_type_get_element_type (gcc_jit_vector_type *vector_type);
22812297

2298+
/* Upcasting from gcc_jit_vector_type to object.
2299+
2300+
This API entrypoint was added in LIBGCCJIT_ABI_55.
2301+
*/
2302+
2303+
extern gcc_jit_object *
2304+
gcc_jit_vector_type_as_object (gcc_jit_vector_type *vector_type);
2305+
22822306
/* Given a type, return the unqualified type, removing "const", "volatile"
22832307
* and alignment qualifiers. */
22842308
extern gcc_jit_type *

gcc/jit/libgccjit.map

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,4 +445,7 @@ LIBGCCJIT_ABI_55 {
445445
global:
446446
gcc_jit_block_get_successor_count;
447447
gcc_jit_block_get_successor;
448+
gcc_jit_function_type_as_object;
449+
gcc_jit_vector_type_as_object;
450+
gcc_jit_region_as_object;
448451
} LIBGCCJIT_ABI_54;

0 commit comments

Comments
 (0)