File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -604,6 +604,19 @@ class java_generic_symbol_typet : public symbol_typet
604604 {
605605 return (generic_typest &)(add (ID_generic_types).get_sub ());
606606 }
607+
608+ // / Check if this symbol has the given generic type. If yes, return its index
609+ // / in the vector of generic types.
610+ // / \param type The type we are looking for.
611+ // / \return The index of the type in the vector of generic types.
612+ optionalt<size_t > generic_type_index (const reference_typet &type) const
613+ {
614+ const auto &type_pointer =
615+ std::find (generic_types ().begin (), generic_types ().end (), type);
616+ if (type_pointer != generic_types ().end ())
617+ return type_pointer - generic_types ().begin ();
618+ return {};
619+ }
607620};
608621
609622// / \param type: the type to check
Original file line number Diff line number Diff line change @@ -407,6 +407,19 @@ class class_typet:public struct_typet
407407 return false ;
408408 }
409409
410+ // / Return the base with the given name, if exists.
411+ // / \param id The name of the base we are looking for.
412+ // / \return The base if exists.
413+ optionalt<baset> get_base (const irep_idt &id) const
414+ {
415+ for (const auto &b : bases ())
416+ {
417+ if (to_symbol_type (b.type ()).get_identifier () == id)
418+ return b;
419+ }
420+ return {};
421+ }
422+
410423 bool is_abstract () const
411424 {
412425 return get_bool (ID_abstract);
You can’t perform that action at this time.
0 commit comments