Skip to content

Commit 495b2e1

Browse files
Remove unnecessary parameter referring to field
1 parent 04e8dda commit 495b2e1

File tree

1 file changed

+36
-41
lines changed

1 file changed

+36
-41
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ class java_bytecode_parsert final : public parsert
8989

9090
void rClassFile();
9191
void rconstant_pool();
92-
void rinterfaces(classt &parsed_class);
93-
void rfields(classt &parsed_class);
94-
void rmethods(classt &parsed_class);
95-
void rmethod(classt &parsed_class);
96-
void
97-
rinner_classes_attribute(classt &parsed_class, const u4 &attribute_length);
92+
void rinterfaces();
93+
void rfields();
94+
void rmethods();
95+
void rmethod();
96+
void rinner_classes_attribute(const u4 &attribute_length);
9897
std::vector<irep_idt> rexceptions_attribute();
99-
void rclass_attribute(classt &parsed_class);
98+
void rclass_attribute();
10099
void rRuntimeAnnotation_attribute(std::vector<annotationt> &);
101100
void rRuntimeAnnotation(annotationt &);
102101
void relement_value_pairs(annotationt::element_value_pairst &);
@@ -113,7 +112,7 @@ class java_bytecode_parsert final : public parsert
113112
void parse_local_variable_type_table(methodt &method);
114113
optionalt<lambda_method_handlet>
115114
parse_method_handle(const class method_handle_infot &entry);
116-
void read_bootstrapmethods_entry(classt &);
115+
void read_bootstrapmethods_entry();
117116

118117
void skip_bytes(std::size_t bytes)
119118
{
@@ -149,9 +148,8 @@ class java_bytecode_parsert final : public parsert
149148
}
150149

151150
void store_unknown_method_handle(
152-
classt &parsed_class,
153151
size_t bootstrap_method_index,
154-
std::vector<u2> u2_values) const;
152+
std::vector<u2> u2_values);
155153
};
156154

157155
#define CONSTANT_Class 7
@@ -470,9 +468,9 @@ void java_bytecode_parsert::rClassFile()
470468
if(super_class!=0)
471469
parsed_class.super_class = constant(super_class).type().get(ID_C_base_name);
472470

473-
rinterfaces(parsed_class);
474-
rfields(parsed_class);
475-
rmethods(parsed_class);
471+
rinterfaces();
472+
rfields();
473+
rmethods();
476474

477475
// count elements of enum
478476
if(parsed_class.is_enum)
@@ -483,7 +481,7 @@ void java_bytecode_parsert::rClassFile()
483481
const u2 attributes_count = read<u2>();
484482

485483
for(std::size_t j=0; j<attributes_count; j++)
486-
rclass_attribute(parsed_class);
484+
rclass_attribute();
487485

488486
get_class_refs();
489487

@@ -837,22 +835,22 @@ void java_bytecode_parsert::rconstant_pool()
837835
});
838836
}
839837

840-
void java_bytecode_parsert::rinterfaces(classt &parsed_class)
838+
void java_bytecode_parsert::rinterfaces()
841839
{
842840
const u2 interfaces_count = read<u2>();
843841

844842
for(std::size_t i=0; i<interfaces_count; i++)
845-
parsed_class.implements.push_back(
843+
parse_tree.parsed_class.implements.push_back(
846844
constant(read<u2>()).type().get(ID_C_base_name));
847845
}
848846

849-
void java_bytecode_parsert::rfields(classt &parsed_class)
847+
void java_bytecode_parsert::rfields()
850848
{
851849
const u2 fields_count = read<u2>();
852850

853851
for(std::size_t i=0; i<fields_count; i++)
854852
{
855-
fieldt &field=parsed_class.add_field();
853+
fieldt &field = parse_tree.parsed_class.add_field();
856854

857855
const u2 access_flags = read<u2>();
858856
const u2 name_index = read<u2>();
@@ -1595,9 +1593,9 @@ exprt java_bytecode_parsert::get_relement_value()
15951593
/// information for the parsed class is overwritten, and the parsed class is
15961594
/// marked as an inner class.
15971595
void java_bytecode_parsert::rinner_classes_attribute(
1598-
classt &parsed_class,
15991596
const u4 &attribute_length)
16001597
{
1598+
classt &parsed_class = parse_tree.parsed_class;
16011599
std::string name = parsed_class.name.c_str();
16021600
const u2 number_of_classes = read<u2>();
16031601
const u4 number_of_bytes_to_be_read = number_of_classes * 8 + 2;
@@ -1685,8 +1683,10 @@ std::vector<irep_idt> java_bytecode_parsert::rexceptions_attribute()
16851683
return exceptions;
16861684
}
16871685

1688-
void java_bytecode_parsert::rclass_attribute(classt &parsed_class)
1686+
void java_bytecode_parsert::rclass_attribute()
16891687
{
1688+
classt &parsed_class = parse_tree.parsed_class;
1689+
16901690
const u2 attribute_name_index = read<u2>();
16911691
const u4 attribute_length = read<u4>();
16921692

@@ -1743,23 +1743,22 @@ void java_bytecode_parsert::rclass_attribute(classt &parsed_class)
17431743

17441744
// mark as read in parsed class
17451745
parsed_class.attribute_bootstrapmethods_read = true;
1746-
read_bootstrapmethods_entry(parsed_class);
1746+
read_bootstrapmethods_entry();
17471747
}
17481748
else if(attribute_name == "InnerClasses")
17491749
{
1750-
java_bytecode_parsert::rinner_classes_attribute(
1751-
parsed_class, attribute_length);
1750+
java_bytecode_parsert::rinner_classes_attribute(attribute_length);
17521751
}
17531752
else
17541753
skip_bytes(attribute_length);
17551754
}
17561755

1757-
void java_bytecode_parsert::rmethods(classt &parsed_class)
1756+
void java_bytecode_parsert::rmethods()
17581757
{
17591758
const u2 methods_count = read<u2>();
17601759

17611760
for(std::size_t j=0; j<methods_count; j++)
1762-
rmethod(parsed_class);
1761+
rmethod();
17631762
}
17641763

17651764
#define ACC_PUBLIC 0x0001u
@@ -1777,9 +1776,9 @@ void java_bytecode_parsert::rmethods(classt &parsed_class)
17771776
#define ACC_ANNOTATION 0x2000u
17781777
#define ACC_ENUM 0x4000u
17791778

1780-
void java_bytecode_parsert::rmethod(classt &parsed_class)
1779+
void java_bytecode_parsert::rmethod()
17811780
{
1782-
methodt &method=parsed_class.add_method();
1781+
methodt &method = parse_tree.parsed_class.add_method();
17831782

17841783
const u2 access_flags = read<u2>();
17851784
const u2 name_index = read<u2>();
@@ -1937,7 +1936,7 @@ java_bytecode_parsert::parse_method_handle(const method_handle_infot &entry)
19371936
/// Read all entries of the `BootstrapMethods` attribute of a class file.
19381937
/// \param parsed_class: the class representation of the class file that is
19391938
/// currently parsed
1940-
void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
1939+
void java_bytecode_parsert::read_bootstrapmethods_entry()
19411940
{
19421941
const u2 num_bootstrap_methods = read<u2>();
19431942
for(size_t bootstrap_method_index = 0;
@@ -1990,8 +1989,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
19901989
// understand
19911990
if(num_bootstrap_arguments < 3)
19921991
{
1993-
store_unknown_method_handle(
1994-
parsed_class, bootstrap_method_index, std::move(u2_values));
1992+
store_unknown_method_handle(bootstrap_method_index, std::move(u2_values));
19951993
debug()
19961994
<< "format of BootstrapMethods entry not recognized: too few arguments"
19971995
<< eom;
@@ -2018,8 +2016,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
20182016
debug() << "format of BootstrapMethods entry not recognized: extra "
20192017
"arguments of wrong type"
20202018
<< eom;
2021-
store_unknown_method_handle(
2022-
parsed_class, bootstrap_method_index, std::move(u2_values));
2019+
store_unknown_method_handle(bootstrap_method_index, std::move(u2_values));
20232020
continue;
20242021
}
20252022

@@ -2036,8 +2033,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
20362033
debug() << "format of BootstrapMethods entry not recognized: arguments "
20372034
"wrong type"
20382035
<< eom;
2039-
store_unknown_method_handle(
2040-
parsed_class, bootstrap_method_index, std::move(u2_values));
2036+
store_unknown_method_handle(bootstrap_method_index, std::move(u2_values));
20412037
continue;
20422038
}
20432039

@@ -2050,8 +2046,7 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
20502046
debug() << "format of BootstrapMethods entry not recognized: method "
20512047
"handle not recognised"
20522048
<< eom;
2053-
store_unknown_method_handle(
2054-
parsed_class, bootstrap_method_index, std::move(u2_values));
2049+
store_unknown_method_handle(bootstrap_method_index, std::move(u2_values));
20552050
continue;
20562051
}
20572052

@@ -2065,12 +2060,12 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
20652060
lambda_method_handle->u2_values = std::move(u2_values);
20662061
debug() << "lambda function reference "
20672062
<< id2string(lambda_method_handle->lambda_method_name)
2068-
<< " in class \"" << parsed_class.name << "\""
2063+
<< " in class \"" << parse_tree.parsed_class.name << "\""
20692064
<< "\n interface type is "
20702065
<< id2string(pool_entry(interface_type_argument.ref1).s)
20712066
<< "\n method type is "
20722067
<< id2string(pool_entry(method_type_argument.ref1).s) << eom;
2073-
parsed_class.add_method_handle(
2068+
parse_tree.parsed_class.add_method_handle(
20742069
bootstrap_method_index, *lambda_method_handle);
20752070
}
20762071
}
@@ -2081,10 +2076,10 @@ void java_bytecode_parsert::read_bootstrapmethods_entry(classt &parsed_class)
20812076
/// table
20822077
/// \param u2_values: The indices of the arguments for the call
20832078
void java_bytecode_parsert::store_unknown_method_handle(
2084-
java_bytecode_parsert::classt &parsed_class,
20852079
size_t bootstrap_method_index,
2086-
std::vector<u2> u2_values) const
2080+
std::vector<u2> u2_values)
20872081
{
20882082
const lambda_method_handlet lambda_method_handle(std::move(u2_values));
2089-
parsed_class.add_method_handle(bootstrap_method_index, lambda_method_handle);
2083+
parse_tree.parsed_class.add_method_handle(
2084+
bootstrap_method_index, lambda_method_handle);
20902085
}

0 commit comments

Comments
 (0)