Example #1
0
// Internal: Is edge significant for may-return analysis?
// + Function call edges are never significant (a return from a function call does not mean that the calling function also
//   returns.
// + A self edge is not significant; it doesn't change the result of the analysis
// + Call-ret edges are significant only if at least one of the sibling function calls returns or if any of the sibling
//   function calls has an indeterminate may-return.
// + Other edges are significant, including E_FUNCTION_XFER edges.
bool
Partitioner::mayReturnIsSignificantEdge(const ControlFlowGraph::ConstEdgeNodeIterator &edge,
                                        std::vector<MayReturnVertexInfo> &vertexInfo) const {
    if (edge == cfg_.edges().end())
        return false;
    if (edge->value().type() == E_FUNCTION_CALL)
        return false;
    if (edge->target() == edge->source())
        return false;
    if (edge->value().type() == E_CALL_RETURN) {
        boost::logic::tribool tb = mayReturnDoesCalleeReturn(edge->source(), vertexInfo);
        return tb || boost::logic::indeterminate(tb);
    }
    return true;
}
Example #2
0
bool
sortEdgesByDst(const ControlFlowGraph::ConstEdgeNodeIterator &a,
               const ControlFlowGraph::ConstEdgeNodeIterator &b) {
    return sortVerticesByAddress(a->target(), b->target());
}