Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add More GNU v2/v3 Tests #68

Merged
merged 13 commits into from
Dec 23, 2024
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build*/
build*/
.cache/
4 changes: 2 additions & 2 deletions src/cxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ansidecl.h makes a mess with the definition of
// const. thus we directly avoid to import the
// demangle.h header and instead define the data here.
#define DMGL_PARAMS (1 << 0) /* Include function args */
#define DMGL_PARAMS (1 << 0) | (1 << 1) /* Include function args and ANSI qualifiers */

char *cplus_demangle_v3(const char *mangled, int options);
char *cplus_demangle_v2(const char *mangled, int options);
Expand Down Expand Up @@ -69,7 +69,7 @@ typedef struct cxx_replace_pair_t {
{ "std::regex_search<" t ">", "std::regex_search<" t ", std::allocator<std::" p "csub_match >, std::regex_traits<" t "> >" }, \
{ "std::regex_search<" t ">", "std::regex_search<" t " const*, std::allocator<std::" p "csub_match >, " t ", std::regex_traits<" t "> >" }, \
{ "std::regex_search<" t ">", "std::regex_search<iterator<" t ">, std::allocator<std::" p "csub_match >, " t ", std::regex_traits<" t "> >" }, \
{ "std::regex_search<std::" p "string>", "std::regex_search<std::char_traits<" t ">, std::allocator<" t ">, std::allocator<std::" p "csub_match >, " t ", std::regex_traits<" t "> >" }
{ "std::regex_search<std::" p "string>", "std::regex_search<std::char_traits<" t ">, std::allocator<" t ">, std::allocator<std::" p "csub_match >, " t ", std::regex_traits<" t "> >" }

static const CxxReplacePair cplus_typedefs[] = {
STD_BASIC_WITH_ALLOC_CHAR("string", "string"),
Expand Down
18 changes: 13 additions & 5 deletions src/gnu_v2/cplus-dem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,9 @@ demangle_template_template_parm(struct work_stuff *work, const char **mangled, s
need_comma = 1;
}
}
if (tname->p[-1] == '>')
string_append(tname, " ");
// test cases failing because of this space
// if (tname->p[-1] == '>')
// string_append(tname, " ");
string_append(tname, "> class");
return (success);
}
Expand Down Expand Up @@ -1422,8 +1423,9 @@ demangle_template(struct work_stuff *work, const char **mangled, string *tname,
if (is_java_array) {
string_append(tname, "[]");
} else {
if (tname->p[-1] == '>')
string_append(tname, " ");
// Test cases failing because of this extra space
// if (tname->p[-1] == '>')
// string_append(tname, " ");
string_append(tname, ">");
}

Expand Down Expand Up @@ -2498,8 +2500,14 @@ do_type(struct work_stuff *work, const char **mangled, string *result)
(*mangled)++;
break;

case 'M':
case 'O': {
(*mangled)++;
string_prepend(&decl, "&&");
if (tk == tk_none)
tk = tk_reference;
break;
}
case 'M': {
type_quals = TYPE_UNQUALIFIED;

member = **mangled == 'M';
Expand Down
Loading