Re: [RFA] C++-ify typedef hash

Pedro Alves
2018-03-26T15:13:53Z

Hi Tom,

Just a few remarks below.

On 03/15/2018 09:58 PM, Tom Tromey wrote:
>
> /* Iteratively try the type pretty-printers specified by PRINTERS
> @@ -463,8 +458,7 @@ apply_ext_lang_type_printers (struct ext_lang_type_printers *printers,
> /* Call this after pretty-printing a type to release all memory held
> by PRINTERS. */

At least this comment should be updated -- there's no "PRINTERS"
parameter any longer.

>
> -void
> -free_ext_lang_type_printers (struct ext_lang_type_printers *printers)
> +ext_lang_type_printers::~ext_lang_type_printers ()
> {

- of the contained objects. */
> +
> +class typedef_hash_table
> +{
> +public:
> +
> + /* Create a new typedef-lookup hash table. */
> + typedef_hash_table ();
> +
> + ~typedef_hash_table ();
> +
> + /* Copy a typedef hash. */
> + typedef_hash_table (const typedef_hash_table *);

This method's prototype gave me pause -- is there a reason this
isn't a regular copy ctor?

>
> -void add_template_parameters (struct typedef_hash_table *, struct type *);
> + typedef_hash_table &operator= (const typedef_hash_table &) = delete;
>
> -struct typedef_hash_table *create_typedef_hash (void);
> + /* Add typedefs from T to the hash table TABLE. */
> + void recursively_update (struct type *);
>
> -void free_typedef_hash (struct typedef_hash_table *);
> + /* Add template parameters from T to the typedef hash TABLE. */
> + void add_template_parameters (struct type *t);
>
> -struct cleanup *make_cleanup_free_typedef_hash (struct typedef_hash_table *);
> + /* Look up the type T in the typedef hash table FLAGS. If T

But FLAGS isn't a hash table, right? The original comment said:

/* Look up the type T in the typedef hash table in with FLAGS.
^^^^^^^

I wonder whether that was a typo for "within".

Maybe this could say something about local/global too.

Thanks,
Pedro Alves