This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cxx-conversion] Add Record Builder Class
- From: Diego Novillo <dnovillo at google dot com>
- To: Lawrence Crowl <crowl at google dot com>
- Cc: nathan at codesourcery dot com, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 13 Feb 2013 14:42:51 -0500
- Subject: Re: [cxx-conversion] Add Record Builder Class
- References: <20130209065835.F0DCF12084A@jade.mtv.corp.google.com> <CAGqM8fY3g+NfCVNg=zY2VRZ2igeXaatPK+Gi9yktPVvEtmtvMQ@mail.gmail.com>
On Tue, Feb 12, 2013 at 2:47 PM, Lawrence Crowl <crowl@google.com> wrote:
> @@ -182,24 +163,9 @@ default_emutls_var_init (tree to, tree d
> static tree
> get_emutls_object_type (void)
> {
> - tree type, type_name, field;
> -
> - type = emutls_object_type;
> - if (type)
> - return type;
> -
> - emutls_object_type = type = lang_hooks.types.make_type (RECORD_TYPE);
> - type_name = NULL;
> - field = targetm.emutls.var_fields (type, &type_name);
> - if (!type_name)
> - type_name = get_identifier ("__emutls_object");
> - type_name = build_decl (UNKNOWN_LOCATION,
> - TYPE_DECL, type_name, type);
> - TYPE_NAME (type) = type_name;
> - TYPE_FIELDS (type) = field;
> - layout_type (type);
> -
> - return type;
> + if (!emutls_object_type)
> + emutls_object_type = targetm.emutls.object_type ();
> + return emutls_object_type;
Hm, this does not look like an idempotent change. Where did I get lost?
===================================================================
> --- gcc/coverage.c (revision 195904)
> +++ gcc/coverage.c (working copy)
> @@ -121,8 +121,8 @@ static const char *const ctr_names[GCOV_
> /* Forward declarations. */
> static void read_counts_file (void);
> static tree build_var (tree, tree, int);
> -static void build_fn_info_type (tree, unsigned, tree);
> -static void build_info_type (tree, tree);
> +static tree build_fn_info_type (unsigned, tree);
> +static tree build_info_type (record_builder &, tree);
I don't really like unnecessary forward declarations. But I guess
it's OK, since you are replacing existing ones.
> -static void
> -build_fn_info_type (tree type, unsigned counters, tree gcov_info_type)
> +static tree
> +build_fn_info_type (unsigned counters, tree gcov_info_type)
So, here you are changing the signature because the caller used to
create an empty record and now it doesn't need to? We are going to be
creating it in the constructor, right?
Diego.