Skip to content

Commit c075086

Browse files
author
svorenova
committed
Refactor a function for base existence
Now simply calls a function for base retrieval
1 parent 8fdf63a commit c075086

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
@@ -396,17 +396,6 @@ class class_typet:public struct_typet
396396
bases().push_back(baset(base));
397397
}
398398

399-
bool has_base(const irep_idt &id) const
400-
{
401-
for(const auto &b : bases())
402-
{
403-
if(to_symbol_type(b.type()).get(ID_identifier)==id)
404-
return true;
405-
}
406-
407-
return false;
408-
}
409-
410399
/// Return the base with the given name, if exists.
411400
/// \param id The name of the base we are looking for.
412401
/// \return The base if exists.
@@ -420,6 +409,11 @@ class class_typet:public struct_typet
420409
return {};
421410
}
422411

412+
bool has_base(const irep_idt &id) const
413+
{
414+
return get_base(id).has_value();
415+
}
416+
423417
bool is_abstract() const
424418
{
425419
return get_bool(ID_abstract);

0 commit comments

Comments
 (0)