Skip to content

Commit 54d618c

Browse files
committed
Apply clang-format
1 parent d6dbce2 commit 54d618c

File tree

2 files changed

+55
-79
lines changed

2 files changed

+55
-79
lines changed

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp

Lines changed: 37 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,20 @@ vsd_configt vsd_configt::from_options(const optionst &options)
2424
"--data-dependencies"};
2525
}
2626

27-
config.value_abstract_type = option_to_abstract_type(
28-
options,
29-
"values",
30-
value_option_mappings,
31-
CONSTANT
32-
);
27+
config.value_abstract_type =
28+
option_to_abstract_type(options, "values", value_option_mappings, CONSTANT);
3329

3430
config.pointer_abstract_type = option_to_abstract_type(
35-
options,
36-
"pointers",
37-
pointer_option_mappings,
38-
POINTER_INSENSITIVE
39-
);
31+
options, "pointers", pointer_option_mappings, POINTER_INSENSITIVE);
4032

4133
config.struct_abstract_type = option_to_abstract_type(
42-
options,
43-
"structs",
44-
struct_option_mappings,
45-
STRUCT_INSENSITIVE
46-
);
34+
options, "structs", struct_option_mappings, STRUCT_INSENSITIVE);
4735

4836
config.array_abstract_type = option_to_abstract_type(
49-
options,
50-
"arrays",
51-
array_option_mappings,
52-
ARRAY_INSENSITIVE
53-
);
37+
options, "arrays", array_option_mappings, ARRAY_INSENSITIVE);
5438

5539
config.union_abstract_type = option_to_abstract_type(
56-
options,
57-
"unions",
58-
union_option_mappings,
59-
UNION_INSENSITIVE
60-
);
40+
options, "unions", union_option_mappings, UNION_INSENSITIVE);
6141

6242
// This should always be on (for efficeny with 3-way merge)
6343
// Does not work with value set
@@ -105,61 +85,57 @@ vsd_configt vsd_configt::intervals()
10585
}
10686

10787
const vsd_configt::option_mappingt vsd_configt::value_option_mappings = {
108-
{ "intervals", INTERVAL },
109-
{ "constants", CONSTANT },
110-
{ "set-of-constants", VALUE_SET }
111-
};
88+
{"intervals", INTERVAL},
89+
{"constants", CONSTANT},
90+
{"set-of-constants", VALUE_SET}};
11291

11392
const vsd_configt::option_mappingt vsd_configt::pointer_option_mappings = {
114-
{ "top-bottom", POINTER_INSENSITIVE },
115-
{ "constants", POINTER_SENSITIVE },
116-
{ "value-set", VALUE_SET }
117-
};
93+
{"top-bottom", POINTER_INSENSITIVE},
94+
{"constants", POINTER_SENSITIVE},
95+
{"value-set", VALUE_SET}};
11896

11997
const vsd_configt::option_mappingt vsd_configt::struct_option_mappings = {
120-
{ "top-bottom", STRUCT_INSENSITIVE },
121-
{ "every-field", STRUCT_SENSITIVE }
122-
};
98+
{"top-bottom", STRUCT_INSENSITIVE},
99+
{"every-field", STRUCT_SENSITIVE}};
123100

124101
const vsd_configt::option_mappingt vsd_configt::array_option_mappings = {
125-
{ "top-bottom", ARRAY_INSENSITIVE },
126-
{ "every-element", ARRAY_SENSITIVE }
127-
};
102+
{"top-bottom", ARRAY_INSENSITIVE},
103+
{"every-element", ARRAY_SENSITIVE}};
128104

129105
const vsd_configt::option_mappingt vsd_configt::union_option_mappings = {
130-
{ "top-bottom", UNION_INSENSITIVE }
131-
};
106+
{"top-bottom", UNION_INSENSITIVE}};
132107

133108
invalid_command_line_argument_exceptiont vsd_configt::invalid_argument(
134-
const std::string& option_name,
135-
const std::string& bad_argument,
136-
const option_mappingt& mapping
137-
) {
109+
const std::string &option_name,
110+
const std::string &bad_argument,
111+
const option_mappingt &mapping)
112+
{
138113
auto option = "--vsd-" + option_name;
139114
auto choices = std::string("");
140-
for (auto& kv : mapping) {
115+
for(auto &kv : mapping)
116+
{
141117
choices += (!choices.empty() ? "|" : "");
142118
choices += kv.first;
143119
}
144120

145-
return invalid_command_line_argument_exceptiont {
146-
"Unknown argument '" + bad_argument + "'",
147-
option,
148-
option + " " + choices };
121+
return invalid_command_line_argument_exceptiont{
122+
"Unknown argument '" + bad_argument + "'", option, option + " " + choices};
149123
}
150124

151125
ABSTRACT_OBJECT_TYPET vsd_configt::option_to_abstract_type(
152-
const optionst& options,
153-
const std::string& option_name,
154-
const option_mappingt& mapping,
155-
ABSTRACT_OBJECT_TYPET default_type
156-
) {
126+
const optionst &options,
127+
const std::string &option_name,
128+
const option_mappingt &mapping,
129+
ABSTRACT_OBJECT_TYPET default_type)
130+
{
157131
const auto argument = options.get_option(option_name);
158132

159-
if (argument.empty()) return default_type;
133+
if(argument.empty())
134+
return default_type;
160135

161136
auto selected = mapping.find(argument);
162-
if (selected == mapping.end()) {
137+
if(selected == mapping.end())
138+
{
163139
throw invalid_argument(option_name, argument, mapping);
164140
}
165141
return selected->second;
@@ -243,7 +219,8 @@ abstract_object_pointert initialize_abstract_object(
243219
}
244220

245221
ABSTRACT_OBJECT_TYPET
246-
variable_sensitivity_object_factoryt::get_abstract_object_type(const typet& type) const
222+
variable_sensitivity_object_factoryt::get_abstract_object_type(
223+
const typet &type) const
247224
{
248225
ABSTRACT_OBJECT_TYPET abstract_object_type = TWO_VALUE;
249226

@@ -288,7 +265,7 @@ variable_sensitivity_object_factoryt::get_abstract_object(
288265
const abstract_environmentt &environment,
289266
const namespacet &ns) const
290267
{
291-
const typet& followed_type = ns.follow(type);
268+
const typet &followed_type = ns.follow(type);
292269
ABSTRACT_OBJECT_TYPET abstract_object_type =
293270
get_abstract_object_type(followed_type);
294271

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,30 @@ struct vsd_configt
7272
static vsd_configt value_set();
7373
static vsd_configt intervals();
7474

75-
vsd_configt() :
76-
value_abstract_type(CONSTANT),
77-
pointer_abstract_type(POINTER_INSENSITIVE),
78-
struct_abstract_type(STRUCT_INSENSITIVE),
79-
array_abstract_type(ARRAY_INSENSITIVE),
80-
union_abstract_type(UNION_INSENSITIVE),
81-
context_tracking { false, true },
82-
advanced_sensitivities { false }
75+
vsd_configt()
76+
: value_abstract_type(CONSTANT),
77+
pointer_abstract_type(POINTER_INSENSITIVE),
78+
struct_abstract_type(STRUCT_INSENSITIVE),
79+
array_abstract_type(ARRAY_INSENSITIVE),
80+
union_abstract_type(UNION_INSENSITIVE),
81+
context_tracking{false, true},
82+
advanced_sensitivities{false}
8383
{
8484
}
8585

8686
private:
8787
using option_mappingt = std::map<std::string, ABSTRACT_OBJECT_TYPET>;
8888

8989
static ABSTRACT_OBJECT_TYPET option_to_abstract_type(
90-
const optionst& options,
91-
const std::string& option_name,
92-
const option_mappingt& mapping,
93-
ABSTRACT_OBJECT_TYPET default_type
94-
);
90+
const optionst &options,
91+
const std::string &option_name,
92+
const option_mappingt &mapping,
93+
ABSTRACT_OBJECT_TYPET default_type);
9594

9695
static invalid_command_line_argument_exceptiont invalid_argument(
97-
const std::string& option_name,
98-
const std::string& bad_argument,
99-
const option_mappingt& mapping
100-
);
96+
const std::string &option_name,
97+
const std::string &bad_argument,
98+
const option_mappingt &mapping);
10199

102100
static const option_mappingt value_option_mappings;
103101
static const option_mappingt pointer_option_mappings;
@@ -147,7 +145,8 @@ class variable_sensitivity_object_factoryt
147145
const namespacet &ns) const;
148146

149147
variable_sensitivity_object_factoryt() = delete;
150-
variable_sensitivity_object_factoryt(const variable_sensitivity_object_factoryt&) = delete;
148+
variable_sensitivity_object_factoryt(
149+
const variable_sensitivity_object_factoryt &) = delete;
151150

152151
private:
153152
/// Decide which abstract object type to use for the variable in question.
@@ -156,7 +155,7 @@ class variable_sensitivity_object_factoryt
156155
/// meant to represent
157156
///
158157
/// \return An enum indicating the abstract object type to use.
159-
ABSTRACT_OBJECT_TYPET get_abstract_object_type(const typet& type) const;
158+
ABSTRACT_OBJECT_TYPET get_abstract_object_type(const typet &type) const;
160159

161160
vsd_configt configuration;
162161
};

0 commit comments

Comments
 (0)