/** * Translate a single linear path to code. * * @param pPath the path to translate * @param callback A callback that receives each <code>ARGState</code> along with their edges and * can then determine what code to generate from it. The default behavior of a <code> * ProcessEdgeFunction</code> is to call {@link #processEdge(ARGState, CFAEdge, Stack)} */ protected void translateSinglePath0(ARGPath pPath, EdgeVisitor callback) { assert pPath.size() >= 1; PathIterator pathIt = pPath.fullPathIterator(); ARGState firstElement = pathIt.getAbstractState(); Stack<FunctionBody> functionStack = new Stack<>(); // create the first function and put in into the stack startFunction(firstElement, functionStack, extractFunctionCallLocation(firstElement)); while (pathIt.hasNext()) { pathIt.advance(); CFAEdge currentCFAEdge = pathIt.getIncomingEdge(); ARGState childElement; if (pathIt.isPositionWithState()) { childElement = pathIt.getAbstractState(); } else { childElement = pathIt.getPreviousAbstractState(); } callback.visit(childElement, currentCFAEdge, functionStack); } }