summaryrefslogtreecommitdiff
path: root/src/ast
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 13:19:23 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-27 13:19:23 +0000
commit27c0cafdfc66ce731156bf076644716f240318d4 (patch)
treecefff28db49f48d12723fb30c41253096bf51ff1 /src/ast
parenta3b85c9737b509fd2a792b65aa2365b9bcc9fe6a (diff)
Support for custom attributes
Diffstat (limited to 'src/ast')
-rw-r--r--src/ast/ast.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 967f27f..b272cae 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -157,6 +157,14 @@ typedef enum
} NodeType;
// ** AST Node Structure **
+typedef struct Attribute
+{
+ char *name;
+ char **args;
+ int arg_count;
+ struct Attribute *next;
+} Attribute;
+
struct ASTNode
{
NodeType type;
@@ -212,6 +220,8 @@ struct ASTNode
int cuda_global; // @global -> __global__
int cuda_device; // @device -> __device__
int cuda_host; // @host -> __host__
+
+ Attribute *attributes; // Custom attributes
} func;
struct
@@ -419,11 +429,12 @@ struct ASTNode
int generic_param_count; // Number of generic parameters
char *parent;
int is_union;
- int is_packed; // @packed attribute.
- int align; // @align(N) attribute, 0 = default.
- int is_incomplete; // Forward declaration (prototype)
- int is_export; // @export attribute
- char **used_structs; // Names of structs used/mixed-in
+ int is_packed; // @packed attribute.
+ int align; // @align(N) attribute, 0 = default.
+ int is_incomplete; // Forward declaration (prototype)
+ int is_export; // @export attribute
+ Attribute *attributes; // Custom attributes
+ char **used_structs; // Names of structs used/mixed-in
int used_struct_count;
} strct;