@@ -46,6 +46,8 @@ struct CTFInteger : public CTFType {
46
46
uint32_t encoding)
47
47
: CTFType(eInteger, uid, name), bits(bits), encoding(encoding) {}
48
48
49
+ static bool classof (const CTFType *T) { return T->kind == eInteger; }
50
+
49
51
uint32_t bits;
50
52
uint32_t encoding;
51
53
};
@@ -55,34 +57,48 @@ struct CTFModifier : public CTFType {
55
57
CTFModifier (Kind kind, lldb::user_id_t uid, uint32_t type)
56
58
: CTFType(kind, uid, " " ), type(type) {}
57
59
60
+ static bool classof (const CTFType *T) {
61
+ return T->kind == ePointer || T->kind == eConst || T->kind == eVolatile ||
62
+ T->kind == eRestrict;
63
+ }
64
+
58
65
public:
59
66
uint32_t type;
60
67
};
61
68
62
69
struct CTFPointer : public CTFModifier {
63
70
CTFPointer (lldb::user_id_t uid, uint32_t type)
64
71
: CTFModifier(ePointer, uid, type) {}
72
+
73
+ static bool classof (const CTFType *T) { return T->kind == ePointer; }
65
74
};
66
75
67
76
struct CTFConst : public CTFModifier {
68
77
CTFConst (lldb::user_id_t uid, uint32_t type)
69
78
: CTFModifier(eConst, uid, type) {}
79
+
80
+ static bool classof (const CTFType *T) { return T->kind == eConst; }
70
81
};
71
82
72
83
struct CTFVolatile : public CTFModifier {
73
84
CTFVolatile (lldb::user_id_t uid, uint32_t type)
74
85
: CTFModifier(eVolatile, uid, type) {}
86
+
87
+ static bool classof (const CTFType *T) { return T->kind == eVolatile; }
75
88
};
76
89
77
90
struct CTFRestrict : public CTFModifier {
78
91
CTFRestrict (lldb::user_id_t uid, uint32_t type)
79
92
: CTFModifier(eRestrict, uid, type) {}
93
+ static bool classof (const CTFType *T) { return T->kind == eRestrict; }
80
94
};
81
95
82
96
struct CTFTypedef : public CTFType {
83
97
CTFTypedef (lldb::user_id_t uid, llvm::StringRef name, uint32_t type)
84
98
: CTFType(eTypedef, uid, name), type(type) {}
85
99
100
+ static bool classof (const CTFType *T) { return T->kind == eTypedef; }
101
+
86
102
uint32_t type;
87
103
};
88
104
@@ -91,6 +107,8 @@ struct CTFArray : public CTFType {
91
107
uint32_t index, uint32_t nelems)
92
108
: CTFType(eArray, uid, name), type(type), index(index), nelems(nelems) {}
93
109
110
+ static bool classof (const CTFType *T) { return T->kind == eArray; }
111
+
94
112
uint32_t type;
95
113
uint32_t index;
96
114
uint32_t nelems;
@@ -110,6 +128,8 @@ struct CTFEnum : public CTFType {
110
128
assert (this ->values .size () == nelems);
111
129
}
112
130
131
+ static bool classof (const CTFType *T) { return T->kind == eEnum; }
132
+
113
133
uint32_t nelems;
114
134
uint32_t size;
115
135
std::vector<Value> values;
@@ -121,6 +141,8 @@ struct CTFFunction : public CTFType {
121
141
: CTFType(eFunction, uid, name), nargs(nargs), return_type(return_type),
122
142
args (std::move(args)), variadic(variadic) {}
123
143
144
+ static bool classof (const CTFType *T) { return T->kind == eFunction; }
145
+
124
146
uint32_t nargs;
125
147
uint32_t return_type;
126
148
@@ -144,6 +166,10 @@ struct CTFRecord : public CTFType {
144
166
: CTFType(kind, uid, name), nfields(nfields), size(size),
145
167
fields (std::move(fields)) {}
146
168
169
+ static bool classof (const CTFType *T) {
170
+ return T->kind == eStruct || T->kind == eUnion;
171
+ }
172
+
147
173
uint32_t nfields;
148
174
uint32_t size;
149
175
std::vector<Field> fields;
@@ -153,17 +179,23 @@ struct CTFStruct : public CTFRecord {
153
179
CTFStruct (lldb::user_id_t uid, llvm::StringRef name, uint32_t nfields,
154
180
uint32_t size, std::vector<Field> fields)
155
181
: CTFRecord(eStruct, uid, name, nfields, size, std::move(fields)){};
182
+
183
+ static bool classof (const CTFType *T) { return T->kind == eStruct; }
156
184
};
157
185
158
186
struct CTFUnion : public CTFRecord {
159
187
CTFUnion (lldb::user_id_t uid, llvm::StringRef name, uint32_t nfields,
160
188
uint32_t size, std::vector<Field> fields)
161
189
: CTFRecord(eUnion, uid, name, nfields, size, std::move(fields)){};
190
+
191
+ static bool classof (const CTFType *T) { return T->kind == eUnion; }
162
192
};
163
193
164
194
struct CTFForward : public CTFType {
165
195
CTFForward (lldb::user_id_t uid, llvm::StringRef name)
166
196
: CTFType(eForward, uid, name) {}
197
+
198
+ static bool classof (const CTFType *T) { return T->kind == eForward; }
167
199
};
168
200
169
201
} // namespace lldb_private
0 commit comments