Skip to content

Commit b031a9f

Browse files
committed
Move vsd_configt function bodies out of line
1 parent 5cc4cf8 commit b031a9f

File tree

2 files changed

+91
-85
lines changed

2 files changed

+91
-85
lines changed

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,93 @@
1010
#include "util/namespace.h"
1111
#include "value_set_abstract_value.h"
1212

13+
vsd_configt vsd_configt::from_options(const optionst &options)
14+
{
15+
vsd_configt config{};
16+
17+
if(
18+
options.get_bool_option("value-set") &&
19+
options.get_bool_option("data-dependencies"))
20+
{
21+
throw invalid_command_line_argument_exceptiont{
22+
"Value set is not currently supported with data dependency analysis",
23+
"--value-set --data-dependencies",
24+
"--data-dependencies"};
25+
}
26+
27+
config.value_abstract_type = option_to_abstract_type(
28+
options,
29+
"values",
30+
value_option_mappings,
31+
CONSTANT
32+
);
33+
34+
config.pointer_abstract_type = option_to_abstract_type(
35+
options,
36+
"pointers",
37+
pointer_option_mappings,
38+
POINTER_INSENSITIVE
39+
);
40+
41+
config.struct_abstract_type = option_to_abstract_type(
42+
options,
43+
"structs",
44+
struct_option_mappings,
45+
STRUCT_INSENSITIVE
46+
);
47+
48+
config.array_abstract_type = option_to_abstract_type(
49+
options,
50+
"arrays",
51+
array_option_mappings,
52+
ARRAY_INSENSITIVE
53+
);
54+
55+
// This should always be on (for efficeny with 3-way merge)
56+
// Does not work with value set
57+
config.context_tracking.last_write_context =
58+
(config.value_abstract_type != VALUE_SET) &&
59+
(config.pointer_abstract_type != VALUE_SET);
60+
config.context_tracking.data_dependency_context =
61+
options.get_bool_option("data-dependencies");
62+
config.advanced_sensitivities.new_value_set =
63+
options.get_bool_option("new-value-set");
64+
65+
return config;
66+
}
67+
68+
vsd_configt vsd_configt::constant_domain()
69+
{
70+
vsd_configt config{};
71+
config.context_tracking.last_write_context = true;
72+
config.value_abstract_type = CONSTANT;
73+
config.pointer_abstract_type = POINTER_SENSITIVE;
74+
config.struct_abstract_type = STRUCT_SENSITIVE;
75+
config.array_abstract_type = ARRAY_SENSITIVE;
76+
return config;
77+
}
78+
79+
vsd_configt vsd_configt::value_set()
80+
{
81+
vsd_configt config{};
82+
config.value_abstract_type = VALUE_SET;
83+
config.pointer_abstract_type = VALUE_SET;
84+
config.struct_abstract_type = STRUCT_SENSITIVE;
85+
config.array_abstract_type = ARRAY_SENSITIVE;
86+
return config;
87+
}
88+
89+
vsd_configt vsd_configt::intervals()
90+
{
91+
vsd_configt config{};
92+
config.context_tracking.last_write_context = true;
93+
config.value_abstract_type = INTERVAL;
94+
config.pointer_abstract_type = POINTER_SENSITIVE;
95+
config.struct_abstract_type = STRUCT_SENSITIVE;
96+
config.array_abstract_type = ARRAY_SENSITIVE;
97+
return config;
98+
}
99+
13100
const vsd_configt::option_mappingt vsd_configt::value_option_mappings = {
14101
{ "intervals", INTERVAL },
15102
{ "constants", CONSTANT },

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h

Lines changed: 4 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -65,92 +65,11 @@ struct vsd_configt
6565
bool new_value_set;
6666
} advanced_sensitivities;
6767

68-
static vsd_configt from_options(const optionst &options)
69-
{
70-
vsd_configt config{};
71-
72-
if(
73-
options.get_bool_option("value-set") &&
74-
options.get_bool_option("data-dependencies"))
75-
{
76-
throw invalid_command_line_argument_exceptiont{
77-
"Value set is not currently supported with data dependency analysis",
78-
"--value-set --data-dependencies",
79-
"--data-dependencies"};
80-
}
81-
82-
config.value_abstract_type = option_to_abstract_type(
83-
options,
84-
"values",
85-
value_option_mappings,
86-
CONSTANT
87-
);
88-
89-
config.pointer_abstract_type = option_to_abstract_type(
90-
options,
91-
"pointers",
92-
pointer_option_mappings,
93-
POINTER_INSENSITIVE
94-
);
95-
96-
config.struct_abstract_type = option_to_abstract_type(
97-
options,
98-
"structs",
99-
struct_option_mappings,
100-
STRUCT_INSENSITIVE
101-
);
102-
103-
config.array_abstract_type = option_to_abstract_type(
104-
options,
105-
"arrays",
106-
array_option_mappings,
107-
ARRAY_INSENSITIVE
108-
);
109-
110-
// This should always be on (for efficeny with 3-way merge)
111-
// Does not work with value set
112-
config.context_tracking.last_write_context =
113-
(config.value_abstract_type != VALUE_SET) &&
114-
(config.pointer_abstract_type != VALUE_SET);
115-
config.context_tracking.data_dependency_context =
116-
options.get_bool_option("data-dependencies");
117-
config.advanced_sensitivities.new_value_set =
118-
options.get_bool_option("new-value-set");
119-
120-
return config;
121-
}
122-
123-
static vsd_configt constant_domain()
124-
{
125-
vsd_configt config{};
126-
config.context_tracking.last_write_context = true;
127-
config.value_abstract_type = CONSTANT;
128-
config.pointer_abstract_type = POINTER_SENSITIVE;
129-
config.struct_abstract_type = STRUCT_SENSITIVE;
130-
config.array_abstract_type = ARRAY_SENSITIVE;
131-
return config;
132-
}
68+
static vsd_configt from_options(const optionst &options);
13369

134-
static vsd_configt value_set()
135-
{
136-
vsd_configt config{};
137-
config.value_abstract_type = VALUE_SET;
138-
config.pointer_abstract_type = VALUE_SET;
139-
config.struct_abstract_type = STRUCT_SENSITIVE;
140-
config.array_abstract_type = ARRAY_SENSITIVE;
141-
return config;
142-
}
143-
144-
static vsd_configt intervals()
145-
{
146-
vsd_configt config{};
147-
config.context_tracking.last_write_context = true;
148-
config.value_abstract_type = INTERVAL;
149-
config.pointer_abstract_type = POINTER_SENSITIVE;
150-
config.struct_abstract_type = STRUCT_SENSITIVE;
151-
config.array_abstract_type = ARRAY_SENSITIVE;
152-
return config;
153-
}
70+
static vsd_configt constant_domain();
71+
static vsd_configt value_set();
72+
static vsd_configt intervals();
15473

15574
private:
15675
using option_mappingt = std::map<std::string, ABSTRACT_OBJECT_TYPET>;

0 commit comments

Comments
 (0)