Skip to content

Commit 851c486

Browse files
committed
Remove all references to optionalt
We now use `std::optional` instead.
1 parent 97ab133 commit 851c486

File tree

279 files changed

+811
-845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+811
-845
lines changed

.clang-format-ignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
jbmc/src/miniz/miniz.cpp
22
src/cprover/wcwidth.c
3-
src/nonstd/optional.hpp
43
unit/catch/catch.hpp

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ int janalyzer_parse_optionst::perform_analysis(
445445
}
446446
else
447447
{
448-
optionalt<std::string> json_file;
448+
std::optional<std::string> json_file;
449449
if(cmdline.isset("json"))
450450
json_file = cmdline.get_value("json");
451451
bool result = taint_analysis(

jbmc/src/java_bytecode/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ used. Under eager loading
677677
\ref java_bytecode_languaget::convert_single_method(const irep_idt &, symbol_table_baset &, lazy_class_to_declared_symbols_mapt &, message_handlert &)
678678
is called once for each method listed in method_bytecode (described above). This
679679
then calls
680-
\ref java_bytecode_languaget::convert_single_method(const irep_idt &, symbol_table_baset &, optionalt<ci_lazy_methods_neededt>, lazy_class_to_declared_symbols_mapt &, message_handlert &);
680+
\ref java_bytecode_languaget::convert_single_method(const irep_idt &, symbol_table_baset &, std::optional<ci_lazy_methods_neededt>, lazy_class_to_declared_symbols_mapt &, message_handlert &);
681681

682682
without a ci_lazy_methods_neededt object, which calls
683683
\ref java_bytecode_convert_method, passing in the method parse tree. This in

jbmc/src/java_bytecode/assignments_from_json.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct object_creation_infot
4444

4545
/// Where runtime types differ from compile-time types, we need to mark the
4646
/// runtime types as needed by lazy methods.
47-
optionalt<ci_lazy_methods_neededt> &needed_lazy_methods;
47+
std::optional<ci_lazy_methods_neededt> &needed_lazy_methods;
4848

4949
/// Map to keep track of reference-equal objects. Each entry has an ID (such
5050
/// that any two reference-equal objects have the same ID) and the expression
@@ -117,7 +117,7 @@ static bool is_enum_with_type_equal_to_declaring_type(
117117
/// A runtime type that is different from the objects compile-time type should
118118
/// be specified in `json` in this way.
119119
/// Type values are of the format "my.package.name.ClassName".
120-
static optionalt<std::string> get_type(const jsont &json)
120+
static std::optional<std::string> get_type(const jsont &json)
121121
{
122122
if(!json.is_object())
123123
return {};
@@ -267,9 +267,9 @@ static jsont get_untyped_string(const jsont &json)
267267
/// \param symbol_table: used to look up the type given its name.
268268
/// \return runtime type of the object, if specified by at least one of the
269269
/// parameters.
270-
static optionalt<java_class_typet> runtime_type(
270+
static std::optional<java_class_typet> runtime_type(
271271
const jsont &json,
272-
const optionalt<std::string> &type_from_array,
272+
const std::optional<std::string> &type_from_array,
273273
const symbol_table_baset &symbol_table)
274274
{
275275
const auto type_from_json = get_type(json);
@@ -304,9 +304,9 @@ static optionalt<java_class_typet> runtime_type(
304304
/// field, this takes priority over \p type_from_array.
305305
/// \param type_from_array: may contain a type name from a containing array.
306306
/// \return if the type of an array was given, the type of its elements.
307-
static optionalt<std::string> element_type_from_array_type(
307+
static std::optional<std::string> element_type_from_array_type(
308308
const jsont &json,
309-
const optionalt<std::string> &type_from_array)
309+
const std::optional<std::string> &type_from_array)
310310
{
311311
if(const auto json_array_type = get_type(json))
312312
{
@@ -332,7 +332,7 @@ static optionalt<std::string> element_type_from_array_type(
332332
code_with_references_listt assign_from_json_rec(
333333
const exprt &expr,
334334
const jsont &json,
335-
const optionalt<std::string> &type_from_array,
335+
const std::optional<std::string> &type_from_array,
336336
object_creation_infot &info);
337337

338338
/// One of the base cases (primitive case) of the recursion.
@@ -392,7 +392,7 @@ static code_frontend_assignt assign_null(const exprt &expr)
392392
static code_with_references_listt assign_array_data_component_from_json(
393393
const exprt &expr,
394394
const jsont &json,
395-
const optionalt<std::string> &type_from_array,
395+
const std::optional<std::string> &type_from_array,
396396
object_creation_infot &info)
397397
{
398398
const auto &java_class_type = followed_class_type(expr, info.symbol_table);
@@ -411,7 +411,7 @@ static code_with_references_listt assign_array_data_component_from_json(
411411
code_frontend_assignt{array_init_data, data_member_expr, info.loc});
412412

413413
size_t index = 0;
414-
const optionalt<std::string> inferred_element_type =
414+
const std::optional<std::string> inferred_element_type =
415415
element_type_from_array_type(json, type_from_array);
416416
const json_arrayt json_array = get_untyped_array(json, element_type);
417417
for(auto it = json_array.begin(); it < json_array.end(); it++, index++)
@@ -457,7 +457,7 @@ static std::pair<code_with_references_listt, exprt>
457457
assign_det_length_array_from_json(
458458
const exprt &expr,
459459
const jsont &json,
460-
const optionalt<std::string> &type_from_array,
460+
const std::optional<std::string> &type_from_array,
461461
object_creation_infot &info)
462462
{
463463
PRECONDITION(is_java_array_type(expr.type()));
@@ -486,7 +486,7 @@ static code_with_references_listt assign_nondet_length_array_from_json(
486486
const exprt &array,
487487
const jsont &json,
488488
const exprt &given_length_expr,
489-
const optionalt<std::string> &type_from_array,
489+
const std::optional<std::string> &type_from_array,
490490
object_creation_infot &info)
491491
{
492492
PRECONDITION(is_java_array_type(array.type()));
@@ -793,7 +793,7 @@ static get_or_create_reference_resultt get_or_create_reference(
793793
static code_with_references_listt assign_reference_from_json(
794794
const exprt &expr,
795795
const jsont &json,
796-
const optionalt<std::string> &type_from_array,
796+
const std::optional<std::string> &type_from_array,
797797
object_creation_infot &info)
798798
{
799799
const std::string &id = has_enum_type(expr, info.symbol_table)
@@ -849,7 +849,7 @@ static code_with_references_listt assign_reference_from_json(
849849
code_with_references_listt assign_from_json_rec(
850850
const exprt &expr,
851851
const jsont &json,
852-
const optionalt<std::string> &type_from_array,
852+
const std::optional<std::string> &type_from_array,
853853
object_creation_infot &info)
854854
{
855855
code_with_references_listt result;
@@ -915,7 +915,7 @@ code_with_references_listt assign_from_json(
915915
const jsont &json,
916916
const irep_idt &function_id,
917917
symbol_table_baset &symbol_table,
918-
optionalt<ci_lazy_methods_neededt> &needed_lazy_methods,
918+
std::optional<ci_lazy_methods_neededt> &needed_lazy_methods,
919919
size_t max_user_array_length,
920920
std::unordered_map<std::string, object_creation_referencet> &references)
921921
{

jbmc/src/java_bytecode/assignments_from_json.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ code_with_references_listt assign_from_json(
100100
const jsont &json,
101101
const irep_idt &function_id,
102102
symbol_table_baset &symbol_table,
103-
optionalt<ci_lazy_methods_neededt> &needed_lazy_methods,
103+
std::optional<ci_lazy_methods_neededt> &needed_lazy_methods,
104104
size_t max_user_array_length,
105105
std::unordered_map<std::string, object_creation_referencet> &references);
106106

jbmc/src/java_bytecode/ci_lazy_methods.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class method_bytecodet
4141
const java_bytecode_parse_treet::methodt &method;
4242
};
4343

44-
typedef optionalt<std::reference_wrapper<const class_method_and_bytecodet>>
44+
typedef std::optional<
45+
std::reference_wrapper<const class_method_and_bytecodet>>
4546
opt_reft;
4647

4748
private:

jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void ci_lazy_methods_neededt::add_cprover_nondet_initialize_if_it_exists(
5353
const irep_idt &class_id)
5454
{
5555
resolve_inherited_componentt resolve_inherited_component{symbol_table};
56-
optionalt<resolve_inherited_componentt::inherited_componentt>
56+
std::optional<resolve_inherited_componentt::inherited_componentt>
5757
cprover_nondet_initialize = resolve_inherited_component(
5858
class_id, "cproverNondetInitialize:()V", true);
5959

jbmc/src/java_bytecode/code_with_references.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct object_creation_referencet
3030
/// This should only be set once the actual elements of the array have been
3131
/// seen, not the first time an `@ref` have been seen, only when `@id` is
3232
/// seen.
33-
optionalt<exprt> array_length;
33+
std::optional<exprt> array_length;
3434
};
3535

3636
/// Base class for code which can contain references which can get replaced

jbmc/src/java_bytecode/generic_parameter_specialization_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void generic_parameter_specialization_mapt::pop(std::size_t container_index)
5151
container_to_specializations.at(container_index).pop();
5252
}
5353

54-
optionalt<reference_typet>
54+
std::optional<reference_typet>
5555
generic_parameter_specialization_mapt::pop(const irep_idt &parameter_name)
5656
{
5757
const auto types_it = param_to_container.find(parameter_name);

jbmc/src/java_bytecode/generic_parameter_specialization_map.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class generic_parameter_specialization_mapt
5353
/// a given type parameter
5454
/// \param parameter_name: The name of the type parameter
5555
/// \returns: The specialization for the given type parameter, if there was
56-
/// one before the pop, or an empty optionalt if the stack was empty
57-
optionalt<reference_typet> pop(const irep_idt &parameter_name);
56+
/// one before the pop, or an empty std::optional if the stack was empty
57+
std::optional<reference_typet> pop(const irep_idt &parameter_name);
5858

5959
/// A wrapper for a generic_parameter_specialization_mapt and a namespacet
6060
/// that can be output to a stream

0 commit comments

Comments
 (0)