How to easily identify that a FUNCTION_DECL is a lambda

Martin Liška mliska@suse.cz
Mon Jul 16 07:23:00 GMT 2018


Hi.

For purpose of --coverage I would like to distinguish lambda functions
among DECL_ARTIFICIAL functions. Currently, cp-tree.h provides macro:

/* Test if FUNCTION_DECL is a lambda function.  */
#define LAMBDA_FUNCTION_P(FNDECL)				\
  (DECL_DECLARES_FUNCTION_P (FNDECL)				\
   && DECL_OVERLOADED_OPERATOR_P (FNDECL)			\
   && DECL_OVERLOADED_OPERATOR_IS (FNDECL, CALL_EXPR)		\
   && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL)))

That's FE-specific function that probably should not be called from
middle-end. Any idea how to distinguish lambdas?

Thanks,
Martin



More information about the Gcc mailing list