Skip to content

Commit

Permalink
Parse and capture outer class for inner classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeannielynnmoulton committed Jul 13, 2018
1 parent 7c4b5aa commit 8201c19
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions jbmc/src/java_bytecode/java_bytecode_convert_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ void java_bytecode_convert_classt::convert(
class_type.set_is_inner_class(c.is_inner_class);
class_type.set_is_static_class(c.is_static_class);
class_type.set_is_anonymous_class(c.is_anonymous_class);
class_type.set_outer_class(c.outer_class);
if(c.is_enum)
{
if(max_array_length != 0 && c.enum_elements > max_array_length)
Expand Down
1 change: 1 addition & 0 deletions jbmc/src/java_bytecode/java_bytecode_parse_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class java_bytecode_parse_treet
bool is_static_class = false;
bool is_anonymous_class = false;
bool attribute_bootstrapmethods_read = false;
irep_idt outer_class; // when no outer class is set, there is no outer class
size_t enum_elements=0;

enum class method_handle_typet
Expand Down
5 changes: 5 additions & 0 deletions jbmc/src/java_bytecode/java_bytecode_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,11 @@ void java_bytecode_parsert::rinner_classes_attribute(
}
else
{
std::string outer_class_info_name =
class_infot(pool_entry(outer_class_info_index))
.get_name(pool_entry_lambda);
parsed_class.outer_class =
constant(outer_class_info_index).type().get(ID_C_base_name);
parsed_class.is_private = is_private;
parsed_class.is_protected = is_protected;
parsed_class.is_public = is_public;
Expand Down
10 changes: 10 additions & 0 deletions jbmc/src/java_bytecode/java_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ class java_class_typet:public class_typet
return set(ID_is_inner_class, is_inner_class);
}

const irep_idt get_outer_class() const
{
return get(ID_outer_class);
}

void set_outer_class(irep_idt outer_class)
{
return set(ID_outer_class, outer_class);
}

const bool get_is_static_class() const
{
return get_bool(ID_is_static);
Expand Down
1 change: 1 addition & 0 deletions src/util/irep_ids.def
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ IREP_ID_ONE(interface)
IREP_ID_TWO(C_must_not_throw, #must_not_throw)
IREP_ID_ONE(is_inner_class)
IREP_ID_ONE(is_anonymous)
IREP_ID_ONE(outer_class)

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

0 comments on commit 8201c19

Please sign in to comment.