Re: [rfa/Ada] Restructure fixed array range fall-back to remove builtin types

Joel Brobecker
2009-06-29T15:38:54Z

> I've tested this on amd64-linux with no regressions, however that doesn't
> say much, as the FSF mainline Ada compiler often doesn't even generate _XA
> types (the front-end generates them, but the middle-end never emits them
> because it considers them unused ...).

It's hard to test, because a failure to find the target type of an XA
type would be a bug in the compiler. So this code is really there to make
things a little more robust.

> * ada-lang.c (to_fixed_range_type): Add ORIG_TYPE argument.
> Fall back to orig_type as index type if symbol lookup fails.
> Allocate result types from ORIG_TYPE's objfile.
> (ada_array_bound_from_type, to_fixed_array_type,
> ada_evaluate_subexp): Pass original index type to
> to_fixed_range_type. Do not pass objfile.
>
> * ada-typeprint.c (print_range_type_named): Add ORIG_TYPE argument.
> Fall back to orig_type as index type if symbol lookup fails.
> (print_array_type, ada_print_type): Pass original index type
> to print_range_type_named.

This makes sense to me, and I verified that you handle the case of
array index types that are range types. So OK.

--
Joel