/** * Returns a deep clone of this {@link AForLoopStmIR} node. * @return a deep clone of this {@link AForLoopStmIR} node */ public AForLoopStmIR clone() { return new AForLoopStmIR( _sourceNode, _tag, _metaData, cloneNode(_init), cloneNode(_cond), cloneNode(_inc), cloneNode(_body) ); }
/** * Creates a new tree field only constructor {@code AForLoopStmIR TAG=forLoop} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param init_ the {@link AVarDeclIR} node for the {@code init} child of this {@link AForLoopStmIR} node * @param cond_ the {@link SExpIR} node for the {@code cond} child of this {@link AForLoopStmIR} node * @param inc_ the {@link SExpIR} node for the {@code inc} child of this {@link AForLoopStmIR} node * @param body_ the {@link SStmIR} node for the {@code body} child of this {@link AForLoopStmIR} node */ public AForLoopStmIR(AVarDeclIR init_, SExpIR cond_, SExpIR inc_, SStmIR body_) { super(null,null,null); this.setInit(init_); this.setCond(cond_); this.setInc(inc_); this.setBody(body_); }
/** * Called by the {@link AForLoopStmIR} node from {@link AForLoopStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link AForLoopStmIR} node */ public void caseAForLoopStmIR(AForLoopStmIR node) throws AnalysisException { _visitedNodes.add(node); inAForLoopStmIR(node); if(node.getInit() != null && !_visitedNodes.contains(node.getInit())) { node.getInit().apply(this); } if(node.getCond() != null && !_visitedNodes.contains(node.getCond())) { node.getCond().apply(this); } if(node.getInc() != null && !_visitedNodes.contains(node.getInc())) { node.getInc().apply(this); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this); } outAForLoopStmIR(node); }
/** * Called by the {@link AForLoopStmIR} node from {@link AForLoopStmIR#apply(IAnalysis)}. * @param node the calling {@link AForLoopStmIR} node */ public void caseAForLoopStmIR(AForLoopStmIR node) throws AnalysisException { _visitedNodes.add(node); inAForLoopStmIR(node); if(node.getInit() != null && !_visitedNodes.contains(node.getInit())) { node.getInit().apply(this); } if(node.getCond() != null && !_visitedNodes.contains(node.getCond())) { node.getCond().apply(this); } if(node.getInc() != null && !_visitedNodes.contains(node.getInc())) { node.getInc().apply(this); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this); } outAForLoopStmIR(node); }
/** * Called by the {@link AForLoopStmIR} node from {@link AForLoopStmIR#apply(IAnalysis)}. * @param node the calling {@link AForLoopStmIR} node */ public void caseAForLoopStmIR(AForLoopStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAForLoopStmIR(node, question); if(node.getInit() != null && !_visitedNodes.contains(node.getInit())) { node.getInit().apply(this, question); } if(node.getCond() != null && !_visitedNodes.contains(node.getCond())) { node.getCond().apply(this, question); } if(node.getInc() != null && !_visitedNodes.contains(node.getInc())) { node.getInc().apply(this, question); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { node.getBody().apply(this, question); } outAForLoopStmIR(node, question); }
/** * Creates a new complete constructor {@code AForLoopStmIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param init_ the {@link AVarDeclIR} node for the {@code init} child of this {@link AForLoopStmIR} node * @param cond_ the {@link SExpIR} node for the {@code cond} child of this {@link AForLoopStmIR} node * @param inc_ the {@link SExpIR} node for the {@code inc} child of this {@link AForLoopStmIR} node * @param body_ the {@link SStmIR} node for the {@code body} child of this {@link AForLoopStmIR} node */ public AForLoopStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, AVarDeclIR init_, SExpIR cond_, SExpIR inc_, SStmIR body_) { super(sourceNode_,tag_,metaData_); this.setInit(init_); this.setCond(cond_); this.setInc(inc_); this.setBody(body_); }
/** * Creates a deep clone of this {@link AForLoopStmIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link AForLoopStmIR} node */ public AForLoopStmIR clone(Map<INode,INode> oldToNewMap) { AForLoopStmIR node = new AForLoopStmIR( _sourceNode, _tag, _metaData, cloneNode(_init, oldToNewMap), cloneNode(_cond, oldToNewMap), cloneNode(_inc, oldToNewMap), cloneNode(_body, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AForLoopStmIR} node from {@link AForLoopStmIR#apply(IAnalysis)}. * @param node the calling {@link AForLoopStmIR} node */ public A caseAForLoopStmIR(AForLoopStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAForLoopStmIR(node, question)); if(node.getInit() != null && !_visitedNodes.contains(node.getInit())) { mergeReturns(retVal,node.getInit().apply(this, question)); } if(node.getCond() != null && !_visitedNodes.contains(node.getCond())) { mergeReturns(retVal,node.getCond().apply(this, question)); } if(node.getInc() != null && !_visitedNodes.contains(node.getInc())) { mergeReturns(retVal,node.getInc().apply(this, question)); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { mergeReturns(retVal,node.getBody().apply(this, question)); } mergeReturns(retVal,outAForLoopStmIR(node, question)); return retVal; }
AForLoopStmIR forLoop = new AForLoopStmIR(); forLoop.setInit(strategy.getForLoopInit(setVar, patterns, pattern)); forLoop.setCond(strategy.getForLoopCond(setVar, patterns, pattern)); forLoop.setInc(strategy.getForLoopInc(setVar, patterns, pattern)); forLoop.setBody(forBody);
/** * Called by the {@link AForLoopStmIR} node from {@link AForLoopStmIR#apply(IAnalysis)}. * @param node the calling {@link AForLoopStmIR} node */ public A caseAForLoopStmIR(AForLoopStmIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAForLoopStmIR(node)); if(node.getInit() != null && !_visitedNodes.contains(node.getInit())) { mergeReturns(retVal,node.getInit().apply(this)); } if(node.getCond() != null && !_visitedNodes.contains(node.getCond())) { mergeReturns(retVal,node.getCond().apply(this)); } if(node.getInc() != null && !_visitedNodes.contains(node.getInc())) { mergeReturns(retVal,node.getInc().apply(this)); } if(node.getBody() != null && !_visitedNodes.contains(node.getBody())) { mergeReturns(retVal,node.getBody().apply(this)); } mergeReturns(retVal,outAForLoopStmIR(node)); return retVal; }