mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[qfcc] Take special care when aliasing aliased types
When aliasing a type that already has aliases, the top node needs to be replaced if it is unnamed, or the alias-free branch of the new node needs to reach around to the alias-free branch of the existing node. This fixes the bogus param counts in qwaq.
This commit is contained in:
parent
78962cb205
commit
218cca71b8
2 changed files with 12 additions and 1 deletions
|
@ -248,7 +248,8 @@ get_type (expr_t *e)
|
|||
type = e->e.symbol->type;
|
||||
break;
|
||||
case ex_temp:
|
||||
return e->e.temp.type;
|
||||
type = e->e.temp.type;
|
||||
break;
|
||||
case ex_value:
|
||||
type = e->e.value->type;
|
||||
break;
|
||||
|
|
|
@ -529,6 +529,16 @@ alias_type (type_t *type, type_t *alias_chain, const char *name)
|
|||
alias->meta = ty_alias;
|
||||
alias->type = type->type;
|
||||
alias->alignment = type->alignment;
|
||||
if (type == alias_chain && type->meta == ty_alias) {
|
||||
// typedef of a type that contains a typedef somewhere
|
||||
// grab the alias-free branch for type
|
||||
type = alias_chain->t.alias.aux_type;
|
||||
if (!alias_chain->name) {
|
||||
// the other typedef is further inside, so replace the unnamed
|
||||
// alias node with the typedef
|
||||
alias_chain = alias_chain->t.alias.full_type;
|
||||
}
|
||||
}
|
||||
alias->t.alias.aux_type = type;
|
||||
alias->t.alias.full_type = alias_chain;
|
||||
if (name) {
|
||||
|
|
Loading…
Reference in a new issue