Skip to content

Commit 5cc4cf8

Browse files
committed
Make variable_sensitivity_object_factoryt member functions const
Deleted constructors Removed redundant initialised flag
1 parent 0d5d83b commit 5cc4cf8

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ abstract_object_pointert initialize_abstract_object(
145145
}
146146

147147
ABSTRACT_OBJECT_TYPET
148-
variable_sensitivity_object_factoryt::get_abstract_object_type(const typet type)
148+
variable_sensitivity_object_factoryt::get_abstract_object_type(const typet& type) const
149149
{
150150
ABSTRACT_OBJECT_TYPET abstract_object_type = TWO_VALUE;
151151

@@ -183,21 +183,14 @@ variable_sensitivity_object_factoryt::get_abstract_object_type(const typet type)
183183

184184
abstract_object_pointert
185185
variable_sensitivity_object_factoryt::get_abstract_object(
186-
const typet type,
186+
const typet &type,
187187
bool top,
188188
bool bottom,
189189
const exprt &e,
190190
const abstract_environmentt &environment,
191-
const namespacet &ns)
191+
const namespacet &ns) const
192192
{
193-
if(!initialized)
194-
{
195-
throw "variable_sensitivity_object_factoryt::get_abstract_object() " \
196-
"called without first calling " \
197-
"variable_sensitivity_object_factoryt::set_options()\n";
198-
}
199-
200-
typet followed_type = ns.follow(type);
193+
const typet& followed_type = ns.follow(type);
201194
ABSTRACT_OBJECT_TYPET abstract_object_type =
202195
get_abstract_object_type(followed_type);
203196

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class variable_sensitivity_object_factoryt
188188
}
189189

190190
explicit variable_sensitivity_object_factoryt(const vsd_configt &options)
191-
: configuration(options), initialized(true)
191+
: configuration(options)
192192
{
193193
}
194194

@@ -207,28 +207,26 @@ class variable_sensitivity_object_factoryt
207207
///
208208
/// \return An abstract object of the appropriate type.
209209
abstract_object_pointert get_abstract_object(
210-
const typet type,
210+
const typet &type,
211211
bool top,
212212
bool bottom,
213213
const exprt &e,
214214
const abstract_environmentt &environment,
215-
const namespacet &ns);
215+
const namespacet &ns) const;
216216

217-
private:
218-
variable_sensitivity_object_factoryt() : initialized(false)
219-
{
220-
}
217+
variable_sensitivity_object_factoryt() = delete;
218+
variable_sensitivity_object_factoryt(const variable_sensitivity_object_factoryt&) = delete;
221219

220+
private:
222221
/// Decide which abstract object type to use for the variable in question.
223222
///
224223
/// \param type: the type of the variable the abstract object is
225224
/// meant to represent
226225
///
227226
/// \return An enum indicating the abstract object type to use.
228-
ABSTRACT_OBJECT_TYPET get_abstract_object_type(const typet type);
227+
ABSTRACT_OBJECT_TYPET get_abstract_object_type(const typet& type) const;
229228

230229
vsd_configt configuration;
231-
bool initialized;
232230
};
233231

234232
#endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_VARIABLE_SENSITIVITY_OBJECT_FACTORY_H // NOLINT(*)

0 commit comments

Comments
 (0)