Cthulhu  0.2.10
Cthulhu compiler collection
tree.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-only
2 
3 #pragma once
4 
5 #include "core/text.h"
6 
7 #include "cthulhu/tree/context.h"
8 #include "cthulhu/tree/attrib.h"
9 #include "cthulhu/tree/cookie.h"
10 
11 #include <stdbool.h>
12 #include <gmp.h>
13 
14 typedef struct logger_t logger_t;
15 
16 typedef struct vector_t vector_t;
17 typedef struct map_t map_t;
18 typedef struct node_t node_t;
19 
20 typedef struct tree_t tree_t;
21 typedef struct tree_cookie_t tree_cookie_t;
22 typedef struct diagnostic_t diagnostic_t;
23 
25 
30 
31 typedef void (*tree_resolve_t)(tree_t *sema, tree_t *self, void *user);
32 typedef void (*tree_resolve_type_t)(tree_t *sema, tree_t *self, void *user);
33 
34 typedef enum sema_tags_t {
35  // all the values in this scope
37 
38  // all the types in this scope
40 
41  // all the procedures in this scope
43 
44  // all the modules in this scope
46 
49 
50 typedef struct tree_attribs_t {
53 
54  const char *mangle;
55  const char *section;
56  const char *deprecated;
58 
59 typedef struct tree_resolve_info_t {
61  void *user;
62 
66 
67 typedef struct tree_t {
69  const node_t *node;
70  const tree_t *type;
72 
73  union {
74  /* eTreeDigit */
75  mpz_t digit_value;
76 
77  /* eTreeBool */
78  bool bool_value;
79 
80  /* eTreeString */
82 
83  /* eTreeExprLoad */
85 
86  /* eTreeExprRef */
87  struct {
88  const tree_t *expr;
89 
90  /* eTreeExprCast */
92  };
93 
94  /* eTreeExprUnary */
95  struct {
98  };
99 
100  /* eTreeExprBinary, eTreeExprCompare */
101  struct {
102  union {
105  };
106 
107  const tree_t *lhs;
108  const tree_t *rhs;
109  };
110 
111  /* eTreeExprCall */
112  struct {
113  const tree_t *callee;
114  const vector_t *args;
115  };
116 
117  /* eTreeError */
118  struct {
120  const char *message;
121  };
122 
123  /* eTreeStmtBlock */
124  const vector_t *stmts;
125 
126  /* eTreeStmtReturn */
127  const tree_t *value;
128 
129  /* eTreeStmtAssign */
130  struct {
132  const tree_t *src;
133  bool init;
134  };
135 
136  /* eTreeStmtLoop, eTreeStmtBranch */
137  struct {
141  };
142 
143  struct {
144  /* eTreeExprSizeOf, eTreeExprAlignOf */
145  const tree_t *object;
146  struct {
147  /* eTreeExprOffset */
148  const tree_t *offset;
149 
150  /* eTreeExprField, eTreeExprOffsetOf */
151  const tree_t *field;
152  };
153  };
154 
155  /* eTreeStmtJump */
156  struct {
159  };
160 
161  /* any declaration */
162  struct {
163  const char *name;
168 
169  union {
170  /* eTreeTypePointer, eTreeTypeReference, eTreeTypeArray */
171  struct {
172  const tree_t *ptr;
173  const tree_t *len;
174  size_t length;
175  };
176 
177  /* eTreeTypeDigit */
178  struct {
181  };
182 
183  /* eTreeTypeStruct */
185 
186  /* eTreeDeclEnum */
187  struct {
191  };
192 
193  /* eTreeDeclCase */
195 
196  struct {
197  const vector_t *params;
198 
199  union {
200  /* eTreeDeclFunction */
201  struct {
204  };
205 
206  /* eTreeTypeClosure */
207  struct {
210  };
211  };
212  };
213 
214  /* eTreeDeclGlobal, eTreeDeclLocal */
215  struct {
217 
219  };
220 
221  /* eTreeDeclModule */
222  struct {
226 
229  };
230  };
231  };
232  };
233 } tree_t;
234 
238 
239 CT_TREE_API tree_t *tree_error(const node_t *node, const diagnostic_t *diagnostic, const char *message, ...);
240 CT_TREE_API tree_t *tree_raise(const node_t *node, logger_t *reports, const diagnostic_t *diagnostic, const char *message, ...);
241 CT_TREE_API void tree_report(logger_t *reports, const tree_t *error);
242 
246 
254 CT_TREE_API tree_t *tree_type_empty(const node_t *node, const char *name);
255 
263 CT_TREE_API tree_t *tree_type_unit(const node_t *node, const char *name);
264 
272 CT_TREE_API tree_t *tree_type_bool(const node_t *node, const char *name);
273 
281 CT_TREE_API tree_t *tree_type_opaque(const node_t *node, const char *name);
282 
292 CT_TREE_API tree_t *tree_type_digit(const node_t *node, const char *name, digit_t digit, sign_t sign);
293 
304 CT_TREE_API tree_t *tree_type_closure(const node_t *node, const char *name, const tree_t *result, const vector_t *params, tree_arity_t arity);
305 
315 CT_TREE_API tree_t *tree_type_pointer(const node_t *node, const char *name, const tree_t *pointer, size_t length);
316 
325 CT_TREE_API tree_t *tree_type_reference(const node_t *node, const char *name, const tree_t *reference);
326 
335 CT_TREE_API tree_t *tree_type_array(const node_t *node, const char *name, const tree_t *array, size_t length);
336 
340 
341 CT_TREE_API tree_t *tree_expr_empty(const node_t *node, const tree_t *type);
342 CT_TREE_API tree_t *tree_expr_unit(const node_t *node, const tree_t *type);
343 CT_TREE_API tree_t *tree_expr_bool(const node_t *node, const tree_t *type, bool value);
344 CT_TREE_API tree_t *tree_expr_digit(const node_t *node, const tree_t *type, const mpz_t value);
345 CT_TREE_API tree_t *tree_expr_digit_int(const node_t *node, const tree_t *type, int value);
346 
356 CT_TREE_API tree_t *tree_expr_string(const node_t *node, const tree_t *type, const char *value, size_t length);
357 
373 CT_TREE_API tree_t *tree_expr_cast(const node_t *node, const tree_t *type, const tree_t *expr, tree_cast_t cast);
374 
382 CT_TREE_API tree_t *tree_expr_load(const node_t *node, tree_t *expr);
383 
391 CT_TREE_API tree_t *tree_expr_address(const node_t *node, tree_t *expr);
392 
393 CT_TREE_API tree_t *tree_expr_unary(const node_t *node, unary_t unary, tree_t *expr);
394 CT_TREE_API tree_t *tree_expr_binary(const node_t *node, const tree_t *type, binary_t binary, const tree_t *lhs, const tree_t *rhs);
395 CT_TREE_API tree_t *tree_expr_compare(const node_t *node, const tree_t *type, compare_t compare, const tree_t *lhs, const tree_t *rhs);
396 
397 CT_TREE_API tree_t *tree_expr_field(const node_t *node, const tree_t *type, tree_t *object, tree_t *field);
398 
399 CT_TREE_API tree_t *tree_expr_offset(const node_t *node, const tree_t *type, tree_t *object, tree_t *offset);
400 
401 CT_TREE_API tree_t *tree_expr_call(const node_t *node, const tree_t *callee, const vector_t *args);
402 
406 
414 CT_TREE_API tree_t *tree_stmt_block(const node_t *node, const vector_t *stmts);
415 
425 CT_TREE_API tree_t *tree_stmt_return(const node_t *node, const tree_t *value);
426 
427 CT_TREE_API tree_t *tree_stmt_assign(const node_t *node, tree_t *dst, const tree_t *src);
428 CT_TREE_API tree_t *tree_stmt_init(const node_t *node, tree_t *dst, tree_t *src);
429 CT_TREE_API tree_t *tree_stmt_loop(const node_t *node, tree_t *cond, tree_t *body, tree_t *other);
430 CT_TREE_API tree_t *tree_stmt_branch(const node_t *node, tree_t *cond, tree_t *then, tree_t *other);
431 CT_TREE_API tree_t *tree_stmt_jump(const node_t *node, tree_t *label, tree_jump_t jump);
432 
436 
437 // delay the resolve of a declaration
438 CT_TREE_API tree_t *tree_resolve(tree_cookie_t *cookie, const tree_t *decl);
439 CT_TREE_API tree_t *tree_resolve_type(tree_cookie_t *cookie, const tree_t *decl);
440 
441 CT_TREE_API tree_t *tree_open_decl(const node_t *node, const char *name, tree_resolve_info_t resolve);
442 CT_TREE_API void tree_close_decl(tree_t *self, const tree_t *other);
443 
447 
448 CT_TREE_API tree_t *tree_decl_global(
449  const node_t *node, const char *name,
450  tree_storage_t storage, const tree_t *type, tree_t *initial
451 );
452 
453 CT_TREE_API tree_t *tree_open_global(
454  const node_t *node, const char *name,
455  const tree_t *type, tree_resolve_info_t resolve
456 );
457 
458 CT_TREE_API void tree_close_global(tree_t *self, tree_t *value);
459 
463 
464 CT_TREE_API tree_t *tree_decl_function(
465  const node_t *node, const char *name, const tree_t *signature,
466  const vector_t *params, vector_t *locals, tree_t *body
467 );
468 
469 CT_TREE_API tree_t *tree_open_function(
470  const node_t *node, const char *name,
471  const tree_t *signature, tree_resolve_info_t resolve
472 );
473 
474 CT_TREE_API void tree_close_function(tree_t *self, tree_t *body);
475 
479 
480 CT_TREE_API tree_t *tree_decl_struct(const node_t *node, const char *name, vector_t *fields);
481 CT_TREE_API tree_t *tree_open_struct(const node_t *node, const char *name, tree_resolve_info_t resolve);
482 CT_TREE_API void tree_close_struct(tree_t *self, vector_t *fields);
483 
487 
488 CT_TREE_API tree_t *tree_decl_union(const node_t *node, const char *name, vector_t *fields);
489 CT_TREE_API tree_t *tree_open_union(const node_t *node, const char *name, tree_resolve_info_t resolve);
490 CT_TREE_API void tree_close_union(tree_t *self, vector_t *fields);
491 
495 
496 CT_TREE_API tree_t *tree_decl_enum(const node_t *node, const char *name, const tree_t *underlying, vector_t *fields, tree_t *default_case);
497 CT_TREE_API tree_t *tree_open_enum(const node_t *node, const char *name, tree_resolve_info_t resolve);
498 CT_TREE_API void tree_close_enum(tree_t *self, const tree_t *underlying, vector_t *fields, tree_t *default_case);
499 
503 
504 CT_TREE_API tree_t *tree_decl_param(const node_t *node, const char *name, const tree_t *type);
505 CT_TREE_API tree_t *tree_decl_field(const node_t *node, const char *name, const tree_t *type);
506 CT_TREE_API tree_t *tree_decl_local(const node_t *node, const char *name, tree_storage_t storage, const tree_t *type);
507 CT_TREE_API tree_t *tree_decl_case(const node_t *node, const char *name, const tree_t *type, tree_t *expr);
508 
512 
513 CT_TREE_API void tree_add_local(tree_t *self, tree_t *decl);
514 CT_TREE_API void tree_add_enum(tree_t *self, tree_t *decl);
515 CT_TREE_API void tree_set_attrib(tree_t *self, const tree_attribs_t *attrib);
516 CT_TREE_API void tree_set_type(tree_t *self, const tree_t *type);
517 
518 CT_TREE_API tree_t *tree_alias(const tree_t *tree, const char *name);
519 
520 CT_TREE_API tree_t *tree_type_alias(const node_t *node, const char *name, const tree_t *type, tree_quals_t quals);
521 
522 CT_TREE_API const tree_t *tree_follow_type(const tree_t *type);
523 
527 
528 // only declarations placed in the tags eSemaValues, eSemaTypes, eSemaProcs, and eSemaModules
529 // will be emitted, they are also required to be valid tree_t objects
530 // any custom slots can contain any data, but they will not be emitted
531 
532 CT_TREE_API tree_t *tree_module_root(logger_t *reports, tree_cookie_t *cookie, const node_t *node, const char *name, size_t decls, const size_t *sizes, arena_t *arena);
533 
544 CT_TREE_API tree_t *tree_module(tree_t *parent, const node_t *node, const char *name, size_t decls, const size_t *sizes);
545 
554 CT_TREE_API void *tree_module_get(tree_t *self, size_t tag, const char *name);
555 
556 
566 CT_TREE_API void *tree_module_find(tree_t *sema, size_t tag, const char *name, tree_t **module);
567 
579 CT_TREE_API void *tree_module_set(tree_t *self, size_t tag, const char *name, void *value);
580 
581 CT_TREE_API map_t *tree_module_tag(const tree_t *self, size_t tag);
582 
589 CT_TREE_API tree_cookie_t *tree_get_cookie(tree_t *sema);
590 
592 
#define CT_BEGIN_API
Definition: compiler.h:129
#define CT_END_API
Definition: compiler.h:130
typedefCT_BEGIN_API struct tree_t tree_t
Definition: attrib.h:16
tree_arity_t
all arities
Definition: ops.h:64
CT_TREE_API tree_t * tree_open_decl(const node_t *node, const char *name, tree_resolve_info_t resolve)
Definition: decl.c:212
sema_tags_t
Definition: tree.h:34
CT_TREE_API tree_t * tree_type_alias(const node_t *node, const char *name, const tree_t *type, tree_quals_t quals)
Definition: decl.c:268
CT_TREE_API tree_t * tree_open_function(const node_t *node, const char *name, const tree_t *signature, tree_resolve_info_t resolve)
Definition: decl.c:147
tree_jump_t
the type of jump
Definition: ops.h:80
CT_TREE_API tree_t * tree_expr_unit(const node_t *node, const tree_t *type)
Definition: tree.c:203
CT_TREE_API tree_t * tree_stmt_jump(const node_t *node, tree_t *label, tree_jump_t jump)
Definition: tree.c:425
CT_TREE_API tree_t * tree_type_reference(const node_t *node, const char *name, const tree_t *reference)
create a reference type
Definition: tree.c:185
CT_TREE_API void tree_report(logger_t *reports, const tree_t *error)
Definition: tree.c:49
CT_TREE_API tree_t * tree_expr_field(const node_t *node, const tree_t *type, tree_t *object, tree_t *field)
Definition: tree.c:319
CT_TREE_API tree_t * tree_stmt_loop(const node_t *node, tree_t *cond, tree_t *body, tree_t *other)
Definition: tree.c:401
CT_TREE_API tree_t * tree_decl_enum(const node_t *node, const char *name, const tree_t *underlying, vector_t *fields, tree_t *default_case)
Definition: decl.c:366
CT_TREE_API tree_t * tree_expr_offset(const node_t *node, const tree_t *type, tree_t *object, tree_t *offset)
Definition: tree.c:333
CT_TREE_API tree_t * tree_decl_struct(const node_t *node, const char *name, vector_t *fields)
Definition: decl.c:298
void(* tree_resolve_t)(tree_t *sema, tree_t *self, void *user)
Definition: tree.h:31
CT_TREE_API tree_t * tree_type_closure(const node_t *node, const char *name, const tree_t *result, const vector_t *params, tree_arity_t arity)
create a function pointer type
Definition: tree.c:146
CT_TREE_API tree_t * tree_type_empty(const node_t *node, const char *name)
create an empty type, this is a type that has no values and can never be created in a well defined pr...
Definition: tree.c:118
CT_TREE_API void tree_close_enum(tree_t *self, const tree_t *underlying, vector_t *fields, tree_t *default_case)
Definition: decl.c:383
CT_TREE_API tree_t * tree_expr_digit(const node_t *node, const tree_t *type, const mpz_t value)
Definition: tree.c:217
CT_TREE_API tree_t * tree_expr_cast(const node_t *node, const tree_t *type, const tree_t *expr, tree_cast_t cast)
create a cast expression
Definition: tree.c:251
CT_TREE_API void tree_add_enum(tree_t *self, tree_t *decl)
CT_TREE_API void tree_close_union(tree_t *self, vector_t *fields)
Definition: decl.c:343
CT_TREE_API tree_t * tree_type_bool(const node_t *node, const char *name)
create a bool type, this is a type that has only two values, true and false
Definition: tree.c:128
CT_TREE_API tree_t * tree_module(tree_t *parent, const node_t *node, const char *name, size_t decls, const size_t *sizes)
create a new module
Definition: sema.c:52
CT_TREE_API tree_t * tree_open_global(const node_t *node, const char *name, const tree_t *type, tree_resolve_info_t resolve)
Definition: decl.c:140
tree_cast_t
all casts
Definition: ops.h:56
tree_quals_t
all type qualifiers
Definition: ops.h:25
CT_TREE_API tree_t * tree_expr_unary(const node_t *node, unary_t unary, tree_t *expr)
Definition: tree.c:290
CT_TREE_API void tree_close_function(tree_t *self, tree_t *body)
Definition: decl.c:168
CT_TREE_API tree_t * tree_stmt_init(const node_t *node, tree_t *dst, tree_t *src)
Definition: tree.c:396
CT_TREE_API tree_t * tree_decl_field(const node_t *node, const char *name, const tree_t *type)
Definition: decl.c:193
CT_TREE_API tree_t * tree_open_struct(const node_t *node, const char *name, tree_resolve_info_t resolve)
Definition: decl.c:307
CT_TREE_API map_t * tree_module_tag(const tree_t *self, size_t tag)
Definition: sema.c:125
CT_TREE_API tree_t * tree_decl_global(const node_t *node, const char *name, tree_storage_t storage, const tree_t *type, tree_t *initial)
Definition: decl.c:123
tree_visibility_t
symbol visibility
Definition: ops.h:88
void(* tree_resolve_type_t)(tree_t *sema, tree_t *self, void *user)
Definition: tree.h:32
CT_TREE_API tree_t * tree_stmt_return(const node_t *node, const tree_t *value)
create a return statement
Definition: tree.c:368
CT_TREE_API void * tree_module_find(tree_t *sema, size_t tag, const char *name, tree_t **module)
search for a declaration in a module also returns the module that the declaration was found in
Definition: sema.c:82
CT_TREE_API tree_t * tree_error(const node_t *node, const diagnostic_t *diagnostic, const char *message,...)
Definition: tree.c:67
CT_TREE_API tree_t * tree_expr_compare(const node_t *node, const tree_t *type, compare_t compare, const tree_t *lhs, const tree_t *rhs)
Definition: tree.c:307
CT_TREE_API tree_t * tree_decl_union(const node_t *node, const char *name, vector_t *fields)
Definition: decl.c:326
CT_TREE_API tree_t * tree_open_enum(const node_t *node, const char *name, tree_resolve_info_t resolve)
Definition: decl.c:373
CT_TREE_API tree_t * tree_type_pointer(const node_t *node, const char *name, const tree_t *pointer, size_t length)
create a pointer type
Definition: tree.c:165
CT_TREE_API tree_t * tree_type_opaque(const node_t *node, const char *name)
create an opaque pointer type
Definition: tree.c:133
sign_t
integer sign
Definition: ops.h:104
CT_TREE_API tree_cookie_t * tree_get_cookie(tree_t *sema)
return a resolution cookie
Definition: sema.c:136
binary_t
all binary operators
Definition: ops.h:32
CT_TREE_API tree_t * tree_raise(const node_t *node, logger_t *reports, const diagnostic_t *diagnostic, const char *message,...)
Definition: tree.c:76
CT_TREE_API tree_t * tree_expr_call(const node_t *node, const tree_t *callee, const vector_t *args)
Definition: tree.c:344
eval_model_t
tree evaluation model
Definition: ops.h:112
CT_TREE_API tree_t * tree_expr_string(const node_t *node, const tree_t *type, const char *value, size_t length)
create a string expression
Definition: tree.c:235
CT_TREE_API tree_t * tree_expr_digit_int(const node_t *node, const tree_t *type, int value)
Definition: tree.c:226
CT_TREE_API tree_t * tree_decl_param(const node_t *node, const char *name, const tree_t *type)
Definition: decl.c:188
CT_TREE_API tree_t * tree_expr_bool(const node_t *node, const tree_t *type, bool value)
Definition: tree.c:208
CT_TREE_API tree_t * tree_open_union(const node_t *node, const char *name, tree_resolve_info_t resolve)
Definition: decl.c:335
CT_TREE_API void tree_close_global(tree_t *self, tree_t *value)
Definition: decl.c:162
CT_TREE_API tree_t * tree_expr_binary(const node_t *node, const tree_t *type, binary_t binary, const tree_t *lhs, const tree_t *rhs)
Definition: tree.c:298
CT_TREE_API tree_t * tree_module_root(logger_t *reports, tree_cookie_t *cookie, const node_t *node, const char *name, size_t decls, const size_t *sizes, arena_t *arena)
Definition: sema.c:42
CT_TREE_API void tree_close_struct(tree_t *self, vector_t *fields)
Definition: decl.c:315
CT_TREE_API tree_t * tree_expr_load(const node_t *node, tree_t *expr)
load a value from a pointer or storage
Definition: tree.c:261
tree_linkage_t
the linkage of a declaration
Definition: ops.h:72
CT_TREE_API tree_t * tree_resolve_type(tree_cookie_t *cookie, const tree_t *decl)
Definition: decl.c:102
tree_kind_t
all tree node types
Definition: ops.h:17
digit_t
digit width
Definition: ops.h:96
CT_TREE_API tree_t * tree_expr_address(const node_t *node, tree_t *expr)
create a reference to an object
Definition: tree.c:281
CT_TREE_API tree_t * tree_type_digit(const node_t *node, const char *name, digit_t digit, sign_t sign)
create a digit type
Definition: tree.c:138
unary_t
all unary operators
Definition: ops.h:48
CT_TREE_API tree_t * tree_decl_case(const node_t *node, const char *name, const tree_t *type, tree_t *expr)
Definition: decl.c:205
CT_TREE_API const tree_t * tree_follow_type(const tree_t *type)
Definition: decl.c:274
CT_TREE_API tree_t * tree_stmt_assign(const node_t *node, tree_t *dst, const tree_t *src)
Definition: tree.c:391
CT_TREE_API tree_t * tree_stmt_block(const node_t *node, const vector_t *stmts)
create a block statement
Definition: tree.c:359
CT_TREE_API void tree_set_type(tree_t *self, const tree_t *type)
Definition: context.c:150
CT_TREE_API void tree_add_local(tree_t *self, tree_t *decl)
Definition: decl.c:243
CT_TREE_API tree_t * tree_alias(const tree_t *tree, const char *name)
Definition: decl.c:258
CT_TREE_API void tree_close_decl(tree_t *self, const tree_t *other)
Definition: decl.c:217
CT_TREE_API tree_t * tree_resolve(tree_cookie_t *cookie, const tree_t *decl)
Definition: decl.c:47
CT_TREE_API tree_t * tree_type_unit(const node_t *node, const char *name)
create a unit type, this is a type that has only one value. equivilent to void
Definition: tree.c:123
compare_t
all comparison operators
Definition: ops.h:40
CT_TREE_API void * tree_module_set(tree_t *self, size_t tag, const char *name, void *value)
set a declaration in the current module
Definition: sema.c:111
CT_TREE_API void tree_set_attrib(tree_t *self, const tree_attribs_t *attrib)
Definition: decl.c:251
CT_TREE_API tree_t * tree_stmt_branch(const node_t *node, tree_t *cond, tree_t *then, tree_t *other)
Definition: tree.c:413
CT_TREE_API tree_t * tree_decl_function(const node_t *node, const char *name, const tree_t *signature, const vector_t *params, vector_t *locals, tree_t *body)
Definition: decl.c:224
CT_TREE_API tree_t * tree_decl_local(const node_t *node, const char *name, tree_storage_t storage, const tree_t *type)
Definition: decl.c:198
CT_TREE_API tree_t * tree_type_array(const node_t *node, const char *name, const tree_t *array, size_t length)
create a new array type
Definition: tree.c:175
CT_TREE_API tree_t * tree_expr_empty(const node_t *node, const tree_t *type)
Definition: tree.c:198
CT_TREE_API void * tree_module_get(tree_t *self, size_t tag, const char *name)
recursively search for a declaration in a module
Definition: sema.c:59
@ eSemaCount
Definition: tree.h:47
@ eSemaValues
Definition: tree.h:36
@ eSemaProcs
Definition: tree.h:42
@ eSemaModules
Definition: tree.h:45
@ eSemaTypes
Definition: tree.h:39
an allocator object
Definition: arena.h:86
a diagnostic
Definition: diagnostic.h:27
a logging sink
Definition: notify.c:14
an unordered hash map
Definition: map.h:38
a position in a source file
Definition: node.h:23
a non-owning view of text
Definition: text.h:24
tree_visibility_t visibility
the visibility of the declaration
Definition: tree.h:52
const char * mangle
override the mangle of the declaration
Definition: tree.h:54
const char * deprecated
the reason for deprecation, or NULL if not deprecated
Definition: tree.h:56
tree_linkage_t link
the link type of the declaration
Definition: tree.h:51
const char * section
override the section of the declaration
Definition: tree.h:55
tree_resolve_type_t fn_resolve_type
Definition: tree.h:64
tree_t * sema
Definition: tree.h:60
tree_resolve_t fn_resolve
Definition: tree.h:63
void * user
Definition: tree.h:61
storage for a value
Definition: context.h:23
Definition: tree.h:67
tree_kind_t kind
Definition: tree.h:68
const tree_t * len
Definition: tree.h:173
tree_t * operand
Definition: tree.h:97
const char * message
Definition: tree.h:120
bool bool_value
Definition: tree.h:78
const tree_t * value
Definition: tree.h:127
tree_t * initial
Definition: tree.h:218
compare_t compare
Definition: tree.h:104
tree_t * label
Definition: tree.h:157
sign_t sign
Definition: tree.h:180
const tree_t * field
Definition: tree.h:151
tree_t * default_case
Definition: tree.h:190
tree_t * other
Definition: tree.h:140
const tree_attribs_t * attrib
the attributes of the declaration
Definition: tree.h:164
const tree_t * rhs
Definition: tree.h:108
const tree_t * underlying
Definition: tree.h:188
tree_cookie_t * cookie
Definition: tree.h:225
vector_t * cases
Definition: tree.h:189
const tree_t * lhs
Definition: tree.h:107
const tree_t * callee
Definition: tree.h:113
vector_t * locals
Definition: tree.h:202
logger_t * reports
Definition: tree.h:227
vector_t * fields
Definition: tree.h:184
size_t length
Definition: tree.h:174
const vector_t * args
Definition: tree.h:114
const char * name
the name of the declaration
Definition: tree.h:163
tree_arity_t arity
Definition: tree.h:209
tree_t * cond
Definition: tree.h:138
const tree_t * type
Definition: tree.h:70
const tree_resolve_info_t * resolve
the resolve configuration of the declaration, NULL if resolved
Definition: tree.h:165
binary_t binary
Definition: tree.h:103
text_view_t string_value
Definition: tree.h:81
tree_t * dst
Definition: tree.h:131
tree_quals_t quals
Definition: tree.h:166
tree_cast_t cast
Definition: tree.h:91
eval_model_t eval_model
Definition: tree.h:167
const tree_t * ptr
Definition: tree.h:172
arena_t * arena
Definition: tree.h:223
tree_t * then
Definition: tree.h:139
const tree_t * offset
Definition: tree.h:148
tree_storage_t storage
Definition: tree.h:216
mpz_t digit_value
Definition: tree.h:75
const diagnostic_t * diagnostic
Definition: tree.h:119
const vector_t * stmts
Definition: tree.h:124
const tree_t * object
Definition: tree.h:145
const vector_t * params
Definition: tree.h:197
tree_attribs_t * attribs
Definition: tree.h:71
bool init
Definition: tree.h:133
digit_t digit
Definition: tree.h:179
tree_t * parent
Definition: tree.h:224
tree_t * body
Definition: tree.h:203
vector_t * tags
vector_t<map_t<const char*, void*>*>
Definition: tree.h:228
tree_t * load
Definition: tree.h:84
const tree_t * src
Definition: tree.h:132
const tree_t * expr
Definition: tree.h:88
tree_jump_t jump
Definition: tree.h:158
const node_t * node
Definition: tree.h:69
const tree_t * return_type
Definition: tree.h:208
tree_t * case_value
Definition: tree.h:194
unary_t unary
Definition: tree.h:96
a generic vector of pointers
Definition: vector.c:16