Skip to content

Commit a024c33

Browse files
Parse and capture outer class for inner classes.
1 parent 7c4b5aa commit a024c33

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ void java_bytecode_convert_classt::convert(
279279
class_type.set_is_inner_class(c.is_inner_class);
280280
class_type.set_is_static_class(c.is_static_class);
281281
class_type.set_is_anonymous_class(c.is_anonymous_class);
282+
class_type.set_outer_class(c.outer_class);
282283
if(c.is_enum)
283284
{
284285
if(max_array_length != 0 && c.enum_elements > max_array_length)

jbmc/src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ class java_bytecode_parse_treet
221221
bool is_static_class = false;
222222
bool is_anonymous_class = false;
223223
bool attribute_bootstrapmethods_read = false;
224+
irep_idt outer_class;
224225
size_t enum_elements=0;
225226

226227
enum class method_handle_typet

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,11 @@ void java_bytecode_parsert::rinner_classes_attribute(
16431643
}
16441644
else
16451645
{
1646+
std::string outer_class_info_name =
1647+
class_infot(pool_entry(outer_class_info_index))
1648+
.get_name(pool_entry_lambda);
1649+
parsed_class.outer_class =
1650+
constant(outer_class_info_index).type().get(ID_C_base_name);
16461651
parsed_class.is_private = is_private;
16471652
parsed_class.is_protected = is_protected;
16481653
parsed_class.is_public = is_public;

jbmc/src/java_bytecode/java_types.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ class java_class_typet:public class_typet
121121
return set(ID_is_inner_class, is_inner_class);
122122
}
123123

124+
const irep_idt get_outer_class() const
125+
{
126+
return get(ID_outer_class);
127+
}
128+
129+
void set_outer_class(irep_idt outer_class)
130+
{
131+
return set(ID_outer_class, outer_class);
132+
}
133+
124134
const bool get_is_static_class() const
125135
{
126136
return get_bool(ID_is_static);

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ IREP_ID_ONE(interface)
675675
IREP_ID_TWO(C_must_not_throw, #must_not_throw)
676676
IREP_ID_ONE(is_inner_class)
677677
IREP_ID_ONE(is_anonymous)
678+
IREP_ID_ONE(outer_class)
678679

679680
// Projects depending on this code base that wish to extend the list of
680681
// available ids should provide a file local_irep_ids.h in their source tree and

0 commit comments

Comments
 (0)