diff options
author | Michael Forney <mforney@mforney.org> | 2019-04-21 00:56:07 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-04-21 01:06:39 -0700 |
commit | 9463599fdf38b50afcc68f568cf6ad682428ce74 (patch) | |
tree | 8ab77f6d3984f197ab705003653f3e0e3eb5a5a5 /decl.c | |
parent | 220ec69d2c45b4ab234bf39d227954e49a264e31 (diff) |
Keep track of type properties in type
Diffstat (limited to 'decl.c')
-rw-r--r-- | decl.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -185,7 +185,9 @@ tagspec(struct scope *s) *t = typeuint; t->kind = kind; } else { - t = mktype(kind); + t = mktype(kind, PROPOBJECT); + if (kind == TYPESTRUCT) + t->prop |= PROPAGGR; t->repr = &i64; // XXX t->size = 0; t->align = 0; @@ -220,7 +222,7 @@ tagspec(struct scope *s) next(); if (consume(TASSIGN)) { e = constexpr(s); - if (e->kind != EXPRCONST || !(typeprop(e->type) & PROPINT)) + if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "expected integer constant expression"); if (e->type->basic.issigned && e->constant.i >= 1ull << 63) t->basic.issigned = true; @@ -480,7 +482,7 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs case TLPAREN: /* function declarator */ next(); func: - t = mktype(TYPEFUNC); + t = mktype(TYPEFUNC, PROPDERIVED); t->qual = QUALNONE; t->func.isprototype = false; t->func.isvararg = false; @@ -676,7 +678,7 @@ addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, ui t->size = mt.type->size; } } else { /* bit-field */ - if (!(typeprop(mt.type) & PROPINT)) + if (!(mt.type->prop & PROPINT)) error(&tok.loc, "bit-field has invalid type"); if (align) error(&tok.loc, "alignment specified for bit-field"); |