This is the mail archive of the
mailing list for the GCC project.
Re: C++ PATCH to deal with trivial but non-callable [cd]tors
- From: Jason Merrill <jason at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Oct 2013 12:19:10 -0400
- Subject: Re: C++ PATCH to deal with trivial but non-callable [cd]tors
- Authentication-results: sourceware.org; auth=none
- References: <52680FD9 dot 7040302 at redhat dot com> <2080743 dot sc4IXPmP0S at polaris> <526AC0A1 dot 4040402 at redhat dot com> <5471599 dot klPL436CBS at polaris>
On 10/30/2013 06:14 AM, Eric Botcazou wrote:
+/* Return whether DECL, a method of a C++ TYPE, is trivial, that is to say
+ doesn't do anything for the objects of TYPE. */
+is_trivial_method (const_tree decl, const_tree type)
+ if (cpp_check (decl, IS_CONSTRUCTOR) && !TYPE_NEEDS_CONSTRUCTING (type))
+ return true;
This will tell you whether decl is a constructor for a type with some
non-trivial constructor, but not whether decl itself is non-trivial.
I think a good way to check for any non-trivial methods would be to
check trivial_type_p in the front end and then see if there are any
!DECL_ARTIFICIAL decls in TYPE_METHODS.