File tree 1 file changed +47
-0
lines changed 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 21
21
#include < ansi-c/c_qualifiers.h>
22
22
#include < ansi-c/expr2c_class.h>
23
23
24
+ #include " cpp_name.h"
25
+
24
26
class expr2cppt :public expr2ct
25
27
{
26
28
public:
@@ -169,6 +171,51 @@ std::string expr2cppt::convert_rec(
169
171
170
172
return dest;
171
173
}
174
+ else if (src.id () == ID_struct_tag)
175
+ {
176
+ const struct_typet &struct_type = ns.follow_tag (to_struct_tag_type (src));
177
+
178
+ std::string dest = q;
179
+
180
+ if (src.get_bool (ID_C_class))
181
+ dest += " class" ;
182
+ else if (src.get_bool (ID_C_interface))
183
+ dest += " __interface" ; // MS-specific
184
+ else
185
+ dest += " struct" ;
186
+
187
+ const irept &tag = struct_type.find (ID_tag);
188
+ if (!tag.id ().empty ())
189
+ {
190
+ if (tag.id () == ID_cpp_name)
191
+ dest += " " + to_cpp_name (tag).to_string ();
192
+ else
193
+ dest += id2string (tag.id ());
194
+ }
195
+
196
+ dest += d;
197
+
198
+ return dest;
199
+ }
200
+ else if (src.id () == ID_union_tag)
201
+ {
202
+ const union_typet &union_type = ns.follow_tag (to_union_tag_type (src));
203
+
204
+ std::string dest = q + " union" ;
205
+
206
+ const irept &tag = union_type.find (ID_tag);
207
+ if (!tag.id ().empty ())
208
+ {
209
+ if (tag.id () == ID_cpp_name)
210
+ dest += " " + to_cpp_name (tag).to_string ();
211
+ else
212
+ dest += id2string (tag.id ());
213
+ }
214
+
215
+ dest += d;
216
+
217
+ return dest;
218
+ }
172
219
else if (src.id ()==ID_constructor)
173
220
{
174
221
return " constructor " ;
You can’t perform that action at this time.
0 commit comments