aboutsummaryrefslogtreecommitdiff
path: root/decl.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-21 00:56:07 -0700
committerMichael Forney <mforney@mforney.org>2019-04-21 01:06:39 -0700
commit9463599fdf38b50afcc68f568cf6ad682428ce74 (patch)
tree8ab77f6d3984f197ab705003653f3e0e3eb5a5a5 /decl.c
parent220ec69d2c45b4ab234bf39d227954e49a264e31 (diff)
Keep track of type properties in type
Diffstat (limited to 'decl.c')
-rw-r--r--decl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/decl.c b/decl.c
index 38a4256..361c0d9 100644
--- a/decl.c
+++ b/decl.c
@@ -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");