aboutsummaryrefslogtreecommitdiff
path: root/decl.h
blob: 4335278d27df0c3d4398b6d815f1921f9a195f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
enum declkind {
	DECLTYPE,
	DECLOBJECT,
	DECLFUNC,
	DECLCONST,
	DECLBUILTIN,
};

enum linkage {
	LINKNONE,
	LINKINTERN,
	LINKEXTERN,
};

enum builtinkind {
	BUILTINALLOCA,
	BUILTINCONSTANTP,
	BUILTININFF,
	BUILTINNANF,
	BUILTINOFFSETOF,
	BUILTINVAARG,
	BUILTINVACOPY,
	BUILTINVAEND,
	BUILTINVALIST,
	BUILTINVASTART,
};

struct decl {
	enum declkind kind;
	enum linkage linkage;
	struct type *type;
	struct value *value;

	/* objects and functions */
	struct list link;
	int align;  /* may be more strict than type requires */
	_Bool tentative, defined;

	/* built-ins */
	enum builtinkind builtin;
};

struct scope;
struct func;

struct decl *mkdecl(enum declkind, struct type *, enum linkage);
_Bool decl(struct scope *, struct func *);
struct type *typename(struct scope *);

struct expr;
struct decl *stringdecl(struct expr *);

void emittentativedefns(void);