File tree 3 files changed +16
-16
lines changed
3 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ void cpp_typecheckt::typecheck_compound_bases(struct_typet &type)
18
18
std::set<irep_idt> bases;
19
19
std::set<irep_idt> vbases;
20
20
21
- irep_idt default_class_access=
22
- type.get_bool (ID_C_class)?ID_private:ID_public;
21
+ irep_idt default_class_access = type.default_access ();
23
22
24
23
irept::subt &bases_irep=type.add (ID_bases).get_sub ();
25
24
Original file line number Diff line number Diff line change @@ -976,8 +976,7 @@ void cpp_typecheckt::typecheck_compound_body(symbolt &symbol)
976
976
symbol.type .set (ID_name, symbol.name );
977
977
978
978
// default access
979
- irep_idt access =
980
- type.get_bool (ID_C_class)?ID_private:ID_public;
979
+ irep_idt access = type.default_access ();
981
980
982
981
bool found_ctor=false ;
983
982
bool found_dtor=false ;
@@ -1118,8 +1117,7 @@ void cpp_typecheckt::typecheck_compound_body(symbolt &symbol)
1118
1117
}
1119
1118
1120
1119
// Reset the access type
1121
- access =
1122
- type.get_bool (ID_C_class)?ID_private:ID_public;
1120
+ access = type.default_access ();
1123
1121
1124
1122
// All the data members are now known.
1125
1123
// We now deal with the constructors that we are given.
Original file line number Diff line number Diff line change @@ -226,6 +226,19 @@ class struct_union_typet:public typet
226
226
227
227
irep_idt get_tag () const { return get (ID_tag); }
228
228
void set_tag (const irep_idt &tag) { set (ID_tag, tag); }
229
+
230
+ // / A struct may be a class, where members may have access restrictions.
231
+ bool is_class () const
232
+ {
233
+ return id () == ID_struct && get_bool (ID_C_class);
234
+ }
235
+
236
+ // / Return the access specification for members where access has not been
237
+ // / modified.
238
+ irep_idt default_access () const
239
+ {
240
+ return is_class () ? ID_private : ID_public;
241
+ }
229
242
};
230
243
231
244
// / Check whether a reference to a typet is a \ref struct_union_typet.
@@ -323,16 +336,6 @@ class class_typet:public struct_typet
323
336
return (methodst &)(add (ID_methods).get_sub ());
324
337
}
325
338
326
- bool is_class () const
327
- {
328
- return get_bool (ID_C_class);
329
- }
330
-
331
- irep_idt default_access () const
332
- {
333
- return is_class ()?ID_private:ID_public;
334
- }
335
-
336
339
class baset :public exprt
337
340
{
338
341
public:
You can’t perform that action at this time.
0 commit comments