blob: ef37e0adece1861a6cbd1b7e1a3ea471b5103e48 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
/* Compiler implementation of the D programming language
* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* https://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
* https://www.boost.org/LICENSE_1_0.txt
* https://github.com/dlang/dmd/blob/master/src/dmd/attrib.h
*/
#pragma once
#include "root/port.h"
#include "dsymbol.h"
class Expression;
class Condition;
class StaticForeach;
namespace dmd
{
Expressions *getAttributes(UserAttributeDeclaration *a);
}
/**************************************************************/
class AttribDeclaration : public Dsymbol
{
public:
Dsymbols *decl; // array of Dsymbol's
const char *kind() const override;
bool hasPointers() override final;
void accept(Visitor *v) override { v->visit(this); }
};
class StorageClassDeclaration : public AttribDeclaration
{
public:
StorageClass stc;
StorageClassDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class DeprecatedDeclaration final : public StorageClassDeclaration
{
public:
Expression *msg;
const char *msgstr;
DeprecatedDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class LinkDeclaration final : public AttribDeclaration
{
public:
LINK linkage;
static LinkDeclaration *create(Loc loc, LINK p, Dsymbols *decl);
LinkDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class CPPMangleDeclaration final : public AttribDeclaration
{
public:
CPPMANGLE cppmangle;
CPPMangleDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class CPPNamespaceDeclaration final : public AttribDeclaration
{
public:
Expression *exp;
CPPNamespaceDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class VisibilityDeclaration final : public AttribDeclaration
{
public:
Visibility visibility;
DArray<Identifier*> pkg_identifiers;
VisibilityDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
const char *toPrettyChars(bool unused) override;
void accept(Visitor *v) override { v->visit(this); }
};
class AlignDeclaration final : public AttribDeclaration
{
public:
Expressions *alignExps;
structalign_t salign;
AlignDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class AnonDeclaration final : public AttribDeclaration
{
public:
d_bool isunion;
int sem; // 1 if successful semantic()
unsigned anonoffset; // offset of anonymous struct
unsigned anonstructsize; // size of anonymous struct
unsigned anonalignsize; // size of anonymous struct for alignment purposes
AnonDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
class PragmaDeclaration final : public AttribDeclaration
{
public:
Expressions *args; // array of Expression's
PragmaDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
class ConditionalDeclaration : public AttribDeclaration
{
public:
Condition *condition;
Dsymbols *elsedecl; // array of Dsymbol's for else block
ConditionalDeclaration *syntaxCopy(Dsymbol *s) override;
void accept(Visitor *v) override { v->visit(this); }
};
class StaticIfDeclaration final : public ConditionalDeclaration
{
public:
ScopeDsymbol *scopesym;
d_bool addisdone;
d_bool onStack;
StaticIfDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
class StaticForeachDeclaration final : public AttribDeclaration
{
public:
StaticForeach *sfe;
ScopeDsymbol *scopesym;
d_bool onStack;
d_bool cached;
Dsymbols *cache;
StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
class ForwardingAttribDeclaration final : public AttribDeclaration
{
public:
ForwardingScopeDsymbol *sym;
void accept(Visitor *v) override { v->visit(this); }
};
// Mixin declarations
class MixinDeclaration final : public AttribDeclaration
{
public:
Expressions *exps;
ScopeDsymbol *scopesym;
d_bool compiled;
MixinDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
/**
* User defined attributes look like:
* @(args, ...)
*/
class UserAttributeDeclaration final : public AttribDeclaration
{
public:
Expressions *atts;
UserAttributeDeclaration *syntaxCopy(Dsymbol *s) override;
const char *kind() const override;
void accept(Visitor *v) override { v->visit(this); }
};
|