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 @@ -977,8 +977,7 @@ void cpp_typecheckt::typecheck_compound_body(symbolt &symbol)
977
977
symbol.type .set (ID_name, symbol.name );
978
978
979
979
// default access
980
- irep_idt access =
981
- type.get_bool (ID_C_class)?ID_private:ID_public;
980
+ irep_idt access = type.default_access ();
982
981
983
982
bool found_ctor=false ;
984
983
bool found_dtor=false ;
@@ -1119,8 +1118,7 @@ void cpp_typecheckt::typecheck_compound_body(symbolt &symbol)
1119
1118
}
1120
1119
1121
1120
// Reset the access type
1122
- access =
1123
- type.get_bool (ID_C_class)?ID_private:ID_public;
1121
+ access = type.default_access ();
1124
1122
1125
1123
// All the data members are now known.
1126
1124
// We now deal with the constructors that we are given.
Original file line number Diff line number Diff line change @@ -216,6 +216,19 @@ class struct_union_typet:public typet
216
216
217
217
irep_idt get_tag () const { return get (ID_tag); }
218
218
void set_tag (const irep_idt &tag) { set (ID_tag, tag); }
219
+
220
+ // / A struct may be a class, where members may have access restrictions.
221
+ bool is_class () const
222
+ {
223
+ return id () == ID_struct && get_bool (ID_C_class);
224
+ }
225
+
226
+ // / Return the access specification for members where access has not been
227
+ // / modified.
228
+ irep_idt default_access () const
229
+ {
230
+ return is_class () ? ID_private : ID_public;
231
+ }
219
232
};
220
233
221
234
// / Check whether a reference to a typet is a \ref struct_union_typet.
@@ -313,16 +326,6 @@ class class_typet:public struct_typet
313
326
return (methodst &)(add (ID_methods).get_sub ());
314
327
}
315
328
316
- bool is_class () const
317
- {
318
- return get_bool (ID_C_class);
319
- }
320
-
321
- irep_idt default_access () const
322
- {
323
- return is_class ()?ID_private:ID_public;
324
- }
325
-
326
329
class baset :public exprt
327
330
{
328
331
public:
You can’t perform that action at this time.
0 commit comments