This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-conversion] Add Record Builder Class


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]