@@ -34,6 +34,46 @@ void memory_snapshot_harness_generatort::handle_option(
34
34
if (recursive_initialization_config.handle_option (option, values))
35
35
{
36
36
}
37
+ else if (option == MEMORY_SNAPSHOT_HARNESS_TREAT_POINTER_AS_ARRAY_OPT)
38
+ {
39
+ recursive_initialization_config.pointers_to_treat_as_arrays .insert (
40
+ values.begin (), values.end ());
41
+ }
42
+ else if (option == MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT)
43
+ {
44
+ for (auto const &array_size_pair : values)
45
+ {
46
+ try
47
+ {
48
+ std::string array;
49
+ std::string size;
50
+ split_string (array_size_pair, ' :' , array, size);
51
+ // --associated-array-size implies --treat-pointer-as-array
52
+ // but it is not an error to specify both, so we don't check
53
+ // for duplicates here
54
+ recursive_initialization_config.pointers_to_treat_as_arrays .insert (
55
+ array);
56
+ auto const inserted =
57
+ recursive_initialization_config
58
+ .array_name_to_associated_array_size_variable .emplace (array, size);
59
+ if (!inserted.second )
60
+ {
61
+ throw invalid_command_line_argument_exceptiont{
62
+ " can not have two associated array sizes for one array" ,
63
+ " --" MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT};
64
+ }
65
+ }
66
+ catch (const deserialization_exceptiont &)
67
+ {
68
+ throw invalid_command_line_argument_exceptiont{
69
+ " `" + array_size_pair +
70
+ " ' is in an invalid format for array size pair" ,
71
+ " --" MEMORY_SNAPSHOT_HARNESS_ASSOCIATED_ARRAY_SIZE_OPT,
72
+ " array_name:size_name, where both are the names of global "
73
+ " variables" };
74
+ }
75
+ }
76
+ }
37
77
else if (option == MEMORY_SNAPSHOT_HARNESS_SNAPSHOT_OPT)
38
78
{
39
79
memory_snapshot_file = require_exactly_one_value (option, values);
0 commit comments