Commit 68aac47f by Nathan Sidwell Committed by Nathan Sidwell

re PR demangler/82195 (Undemangleable lambda)

	PR demangler/82195
	* cp-demangle.c (d_encoding): Strip return type when name is a
	LOCAL_NAME.
	(d_local_name): Strip return type of enclosing TYPED_NAME.
	* testsuite/demangle-expected: Add and adjust tests.

From-SVN: r253186
parent 30854aa0
2017-09-25 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_encoding): Strip return type when name is a
LOCAL_NAME.
(d_local_name): Strip return type of enclosing TYPED_NAME.
* testsuite/demangle-expected: Add and adjust tests.
2017-09-21 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
......
......@@ -1338,8 +1338,18 @@ d_encoding (struct d_info *di, int top_level)
ftype = d_bare_function_type (di, has_return_type (dc));
if (ftype)
dc = d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME,
dc, ftype);
{
/* If this is a non-top-level local-name, clear the
return type, so it doesn't confuse the user by
being confused with the return type of whaever
this is nested within. */
if (!top_level && dc->type == DEMANGLE_COMPONENT_LOCAL_NAME
&& ftype->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
d_left (ftype) = NULL;
dc = d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME,
dc, ftype);
}
else
dc = NULL;
}
......@@ -3621,6 +3631,13 @@ d_local_name (struct d_info *di)
name = d_make_default_arg (di, num, name);
}
/* Elide the return type of the containing function so as to not
confuse the user thinking it is the return type of whatever local
function we might be containing. */
if (function->type == DEMANGLE_COMPONENT_TYPED_NAME
&& d_right (function)->type == DEMANGLE_COMPONENT_FUNCTION_TYPE)
d_left (d_right (function)) = NULL;
return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment