virtual std::shared_ptr run()

in include/Analyzer.h [224:267]


  virtual std::shared_ptr<CallGraphFixpointIterator> run(
      bool rebuild_callgraph_on_each_iteration = false) {
    // keep a copy of old function summaries, do fixpoint on this level.

    std::shared_ptr<CallGraphFixpointIterator> fp = nullptr;
    boost::optional<CallGraph> callgraph = boost::none;

    for (int iteration = 0; iteration < m_max_iteration; iteration++) {
      if (m_logger) {
        (*m_logger)(std::string("Iteration ") + std::to_string(iteration + 1));
      }
      if (!callgraph || rebuild_callgraph_on_each_iteration) {
        callgraph = Analysis::call_graph_of(m_program, &this->registry);
      }

      if (!fp || rebuild_callgraph_on_each_iteration) {
        // If the callgraph requires to be rebuilt, we need to rebuild the
        // iterator as well as weak partial ordering should be updated.
        fp = std::make_shared<CallGraphFixpointIterator>(
            *callgraph,
            &this->registry,
            [this, callgraph](
                const Function& func, Registry* reg,
                CallerContext* context) -> std::shared_ptr<FunctionAnalyzer> {
              // intraprocedural part
              return this->run_on_function(func, reg, context, &*callgraph);
            });
      }

      fp->run(CallGraphFixpointIterator::initial_domain());

      if (this->registry.has_update()) {
        this->registry.materialize_update();
      } else {
        if (m_logger) {
          (*m_logger)(std::string("Global fixpoint reached after ") +
                      std::to_string(iteration + 1) + " iterations.");
        }
        break;
      }
    }

    return fp;
  }