This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to easily identify that a FUNCTION_DECL is a lambda
- From: Martin Liška <mliska at suse dot cz>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Cc: Jason Merrill <jason at redhat dot com>, Nathan Sidwell <nathan at acm dot org>
- Date: Mon, 16 Jul 2018 09:23:47 +0200
- Subject: How to easily identify that a FUNCTION_DECL is a lambda
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