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: C++ PATCH to deal with trivial but non-callable [cd]tors


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.  */
+
+static bool
+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.

Jason


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