Skip to content

Commit f8e8cd7

Browse files
author
svorenova
committed
Refactor a function for base existence
Now simply calls a function for base retrieval
1 parent 9b91443 commit f8e8cd7

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/util/std_types.h

+5-11
Original file line numberDiff line numberDiff line change
@@ -390,17 +390,6 @@ class class_typet:public struct_typet
390390
bases().push_back(baset(base));
391391
}
392392

393-
bool has_base(const irep_idt &id) const
394-
{
395-
for(const auto &b : bases())
396-
{
397-
if(to_symbol_type(b.type()).get(ID_identifier)==id)
398-
return true;
399-
}
400-
401-
return false;
402-
}
403-
404393
/// Return the base with the given name, if exists.
405394
/// \param id The name of the base we are looking for.
406395
/// \return The base if exists.
@@ -417,6 +406,11 @@ class class_typet:public struct_typet
417406
return {};
418407
}
419408

409+
bool has_base(const irep_idt &id) const
410+
{
411+
return get_base(id).has_value();
412+
}
413+
420414
bool is_abstract() const
421415
{
422416
return get_bool(ID_abstract);

0 commit comments

Comments
 (0)