// 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::ConstEdgeIterator &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;
}
示例#2
0
bool
sortEdgesBySrc(const ControlFlowGraph::ConstEdgeIterator &a,
               const ControlFlowGraph::ConstEdgeIterator &b) {
    return sortVerticesByAddress(a->source(), b->source());
}