[PATCH] teach compute_objsize about placement new (PR 100876)

Marek Polacek polacek@redhat.com
Wed Jun 2 21:46:00 GMT 2021


On Wed, Jun 02, 2021 at 03:40:49PM -0600, Martin Sebor via Gcc-patches wrote:
> +  if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
> +    {
> +      /* See if this is a call to placement new.  */
> +      if (!fn
> +	  || !DECL_IS_OPERATOR_NEW_P (fn)
> +	  || DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fn))
> +	return NULL_TREE;
> +
> +      tree fname = DECL_ASSEMBLER_NAME (fn);
> +      const char *name = IDENTIFIER_POINTER (fname);
> +      if (strcmp (name, "_ZnwmPv")       // ordinary form
> +	  && strcmp (name, "_ZnamPv"))   // array form
> +	return NULL_TREE;

Not a review, but you can use id_equal here and simplify things.

Marek



More information about the Gcc-patches mailing list