aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-06-17 16:08:01 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-06-17 16:08:01 -0400
commit61ca4737a85b646c6f4f28e5a49e4f89fa44106b (patch)
tree1cc558a7e679f551ed8af13589db5f793e8cd923 /gcc/cp/name-lookup.c
parent7e7666aed8caa20d3351147e6875292ca27cf1d9 (diff)
downloadgcc-61ca4737a85b646c6f4f28e5a49e4f89fa44106b.zip
gcc-61ca4737a85b646c6f4f28e5a49e4f89fa44106b.tar.gz
gcc-61ca4737a85b646c6f4f28e5a49e4f89fa44106b.tar.bz2
re PR c++/43912 ([C++0x] lambda debug info does not describe captured variables)
PR c++/43912 Generate proxy VAR_DECLs for better lambda debug info. * cp-tree.h (FUNCTION_NEEDS_BODY_BLOCK): Add lambda operator(). (LAMBDA_EXPR_PENDING_PROXIES): New. (struct tree_lambda_expr): Add pending_proxies. * name-lookup.c (pushdecl_maybe_friend_1): Handle capture shadowing. (qualify_lookup): Use is_lambda_ignored_entity. * parser.c (cp_parser_lambda_expression): Don't adjust field names. Call insert_pending_capture_proxies. (cp_parser_lambda_introducer): Use this_identifier. (cp_parser_lambda_declarator_opt): Call the object parameter of the op() "__closure" instead of "this". (cp_parser_lambda_body): Call build_capture_proxy. * semantics.c (build_capture_proxy, is_lambda_ignored_entity): New. (insert_pending_capture_proxies, insert_capture_proxy): New. (is_normal_capture_proxy, is_capture_proxy): New. (add_capture): Add __ to field names here, return capture proxy. (add_default_capture): Use this_identifier, adjust to expect add_capture to return a capture proxy. (outer_lambda_capture_p, thisify_lambda_field): Remove. (finish_id_expression, lambda_expr_this_capture): Adjust. (build_lambda_expr): Initialize LAMBDA_EXPR_PENDING_PROXIES. * pt.c (tsubst_copy_and_build): Check that LAMBDA_EXPR_PENDING_PROXIES is null. From-SVN: r175158
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 64a0f9a..953edd5 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -1089,6 +1089,10 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
if (TREE_CODE (oldlocal) == PARM_DECL)
warning_at (input_location, OPT_Wshadow,
"declaration of %q#D shadows a parameter", x);
+ else if (is_capture_proxy (oldlocal))
+ warning_at (input_location, OPT_Wshadow,
+ "declaration of %qD shadows a lambda capture",
+ x);
else
warning_at (input_location, OPT_Wshadow,
"declaration of %qD shadows a previous local",
@@ -4002,13 +4006,8 @@ qualify_lookup (tree val, int flags)
return true;
if (flags & (LOOKUP_PREFER_NAMESPACES | LOOKUP_PREFER_TYPES))
return false;
- /* In unevaluated context, look past normal capture fields. */
- if (cp_unevaluated_operand && TREE_CODE (val) == FIELD_DECL
- && DECL_NORMAL_CAPTURE_P (val))
- return false;
- /* None of the lookups that use qualify_lookup want the op() from the
- lambda; they want the one from the enclosing class. */
- if (TREE_CODE (val) == FUNCTION_DECL && LAMBDA_FUNCTION_P (val))
+ /* Look through lambda things that we shouldn't be able to see. */
+ if (is_lambda_ignored_entity (val))
return false;
return true;
}