Template parameters handling tidy up

Technical correction on how template parameters are stored in a Parm*.
Doesn't actually make any change, but they are now displayed correctly
when using debug options such as -debug-module.
This commit is contained in:
William S Fulton 2022-12-02 19:44:59 +00:00
commit 7bdc708e5f

View file

@ -4485,8 +4485,7 @@ templateparameter : templcpptype def_args {
Parm *p = $1;
$$ = $1;
/* TODO: also slice off the name from the "type" */
/* Rip out the parameter names */
/* Correct the 'type name' parameter string, split into the appropriate "name" and "type" attributes */
String *name = Getattr(p, "name");
if (!name) {
String *type = Getattr(p, "type");
@ -4494,10 +4493,12 @@ templateparameter : templcpptype def_args {
/* A 'class T' parameter */
const char *t = Strchr(type, ' ');
Setattr(p, "name", t + 1);
Setattr(p, "type", NewStringWithSize(type, t - Char(type)));
} else if ((Strncmp(type, "class... ", 9) == 0) || (Strncmp(type, "typename... ", 12) == 0)) {
/* Variadic template args */
const char *t = Strchr(type, ' ');
Setattr(p, "name", t + 1);
Setattr(p, "type", NewStringWithSize(type, t - Char(type)));
Setattr(p, "variadic", "1");
}
}