Cthulhu  0.2.10
Cthulhu compiler collection
builtin.c
Go to the documentation of this file.
1 #include "cthulhu/tree/builtin.h"
2 
3 #include "common.h"
4 #include "cthulhu/tree/ops.h"
5 
6 tree_t *tree_builtin_sizeof(const node_t *node, const tree_t *type, const tree_t *size_type)
7 {
8  tree_t *result = tree_new(eTreeExprSizeOf, node, size_type);
9  result->object = type;
10  return result;
11 }
12 
13 tree_t *tree_builtin_alignof(const node_t *node, const tree_t *type, const tree_t *align_type)
14 {
15  tree_t *result = tree_new(eTreeExprAlignOf, node, align_type);
16  result->object = type;
17  return result;
18 }
19 
20 tree_t *tree_builtin_offsetof(const node_t *node, const tree_t *type, const tree_t *field, const tree_t *offset_type)
21 {
22  tree_t *result = tree_new(eTreeExprOffsetOf, node, offset_type);
23  result->object = type;
24  result->field = field;
25  return result;
26 }
27 
tree_t * tree_builtin_sizeof(const node_t *node, const tree_t *type, const tree_t *size_type)
Definition: builtin.c:6
tree_t * tree_builtin_offsetof(const node_t *node, const tree_t *type, const tree_t *field, const tree_t *offset_type)
Definition: builtin.c:20
tree_t * tree_builtin_alignof(const node_t *node, const tree_t *type, const tree_t *align_type)
Definition: builtin.c:13
CT_LOCAL tree_t * tree_new(tree_kind_t kind, const node_t *node, const tree_t *type)
Definition: tree.c:22
a position in a source file
Definition: node.h:23
Definition: tree.h:67
const tree_t * field
Definition: tree.h:151
const tree_t * object
Definition: tree.h:145