bool Model::check_frame_consistency()

in source/Model.cpp [458:495]


bool Model::check_frame_consistency(const Frame& frame, std::string_view kind)
    const {
  if (frame.is_bottom()) {
    ModelConsistencyError::raise(fmt::format(
        "Model for method `{}` contains a bottom {}.", show(method_), kind));
    return false;
  }
  if (frame.is_artificial_source()) {
    ModelConsistencyError::raise(fmt::format(
        "Model for method `{}` contains an artificial {}.",
        show(method_),
        kind));
    return false;
  }
  if (method_ && (frame.origins().empty() && frame.field_origins().empty())) {
    ModelConsistencyError::raise(fmt::format(
        "Model for method `{}` contains a {} without origins.",
        show(method_),
        kind));
    return false;
  }
  if (frame.via_type_of_ports().is_value()) {
    for (const auto& root : frame.via_type_of_ports().elements()) {
      // Logs invalid ports specifed for via_type_of but does not prevent the
      // model from being created.
      check_port_consistency(AccessPath(root));
    }
  }
  if (frame.via_value_of_ports().is_value()) {
    for (const auto& root : frame.via_value_of_ports().elements()) {
      // Logs invalid ports specifed for via_value_of but does not prevent the
      // model from being created.
      check_port_consistency(AccessPath(root));
    }
  }

  return true;
}