diff --git a/reusablecfg/src/main/jastadd/AlreadyClosedAnalysis.jrag b/reusablecfg/src/main/jastadd/AlreadyClosedAnalysis.jrag index 7bee66a47f999ad74349ee8014c35ddbc071891c..10ce98c15dc1a3aae6bc57f1b73813fab3958e5d 100644 --- a/reusablecfg/src/main/jastadd/AlreadyClosedAnalysis.jrag +++ b/reusablecfg/src/main/jastadd/AlreadyClosedAnalysis.jrag @@ -81,12 +81,12 @@ aspect AlreadyClosedAnalysis { /** Test if the CFG node is a call node with the given variable as receiver. */ syn boolean CfgNode.isCall(Variable receiver) = false; - eq CfgMethodCall.isCall(Variable receiver) = methodAccess().hasReceiver(receiver); + eq CfgMethodCall.isCall(Variable receiver) = getMethodAccess().hasReceiver(receiver); /** Test if the CFG node is a call node for receiver.close(). */ syn boolean CfgNode.isCloseCall(Variable receiver) = false; eq CfgMethodCall.isCloseCall(Variable receiver) = - methodAccess().hasReceiver(receiver) && methodAccess().getID().equals("close"); + getMethodAccess().hasReceiver(receiver) && getMethodAccess().getID().equals("close"); /** Check if this is a Reader or Writer. */ syn boolean TypeDecl.isCloseable() = diff --git a/reusablecfg/src/main/jastadd/CFG.relast b/reusablecfg/src/main/jastadd/CFG.relast index 312c6aaf063ed76de2b0d3d89f5473206201abca..e62d9817594bf8071f750a6d111413e6d56bad1d 100644 --- a/reusablecfg/src/main/jastadd/CFG.relast +++ b/reusablecfg/src/main/jastadd/CFG.relast @@ -14,6 +14,10 @@ * limitations under the License. */ +/** The root of the Control Flow Graph (CFG). */ +Cfg ::= CfgNode*; +rel Cfg.entry -> CfgEntry; + /** A node in a Control Flow Graph (CFG). */ abstract CfgNode; @@ -25,6 +29,7 @@ CfgExit : CfgNode; /** A method call in the CFG. */ CfgMethodCall : CfgNode; +rel CfgMethodCall.methodAccess -> MethodAccess; /** A conditional branch in the CFG. */ abstract CfgBranch : CfgNode; @@ -37,4 +42,24 @@ rel CfgExpressionBranch.hostExpression -> ConditionalExpr; CfgException : CfgNode; /** A marker node used to mark try block entry points or the end of if-statement branches. */ -CfgMarker : CfgNode; +abstract CfgMarker : CfgNode; +CfgLoopEndMarker:CfgMarker ; +rel CfgLoopEndMarker.loop -> BranchTargetStmt; +abstract CfgThenEndMarker:CfgMarker ; +CfgThenEndExprMarker:CfgThenEndMarker ; +CfgThenEndStmtMarker:CfgThenEndMarker ; +rel CfgThenEndExprMarker.condExpr -> ConditionalExpr; +rel CfgThenEndStmtMarker.ifStmt -> IfStmt; +abstract CfgElseEndMarker:CfgMarker ; +CfgElseEndExprMarker:CfgElseEndMarker ; +CfgElseEndStmtMarker:CfgElseEndMarker ; +rel CfgElseEndExprMarker.condExpr -> ConditionalExpr; +rel CfgElseEndStmtMarker.ifStmt -> IfStmt; +CfgTryEntryMarker:CfgMarker ; +rel CfgTryEntryMarker.tryStmt -> TryStmt; +CfgBreakStmtMarker:CfgMarker ; +rel CfgBreakStmtMarker.breakStmt -> BreakStmt; +CfgContinueStmtMarker:CfgMarker; +rel CfgContinueStmtMarker.continueStmt -> ContinueStmt; +CfgReturnStmtMarker:CfgMarker ; +rel CfgReturnStmtMarker.returnStmt -> ReturnStmt; diff --git a/reusablecfg/src/main/jastadd/CfgSearch.jrag b/reusablecfg/src/main/jastadd/CfgSearch.jrag index e950ffe2f24654847136b0fd7f5b8f8c90a804cd..c1e7dc487823c1e47fa8adff556218cc3ec2471b 100644 --- a/reusablecfg/src/main/jastadd/CfgSearch.jrag +++ b/reusablecfg/src/main/jastadd/CfgSearch.jrag @@ -89,7 +89,8 @@ aspect CfgSearch { return null; } - inh lazy CfgEntry CfgNode.cfg(); + inh lazy Cfg CfgNode.containingCfg(); + eq Cfg.getCfgNode().containingCfg() = this; /** * Performs a Breadth-First Search over the CFG predecessors starting from this node. @@ -100,7 +101,7 @@ aspect CfgSearch { public CfgNode CfgNode.reverseBfs(CfgVisitor visitor) { Set<CfgNode> visited = Collections.newSetFromMap( new IdentityHashMap<CfgNode, Boolean>()); - cfg().initPredecessors(); + containingCfg().getEntry().initPredecessors(); Queue<CfgNode> work = new LinkedList<CfgNode>(); work.add(this); while (!work.isEmpty()) { diff --git a/reusablecfg/src/main/jastadd/PrintCfg.jrag b/reusablecfg/src/main/jastadd/PrintCfg.jrag index 4c94b4efaddb0aca4f6c336cfee6af5b59968adc..95e22cadcc8b833fdbe7ed6c33d2eb696c24a93e 100644 --- a/reusablecfg/src/main/jastadd/PrintCfg.jrag +++ b/reusablecfg/src/main/jastadd/PrintCfg.jrag @@ -112,8 +112,7 @@ aspect PrintCfg { eq CfgMarker.name() = markerName(); eq CfgMethodCall.name() = callLabel(); - inh String CfgMethodCall.callLabel(); - eq MethodAccess.call().callLabel() = name() + "()"; + syn String CfgMethodCall.callLabel() = getMethodAccess().name() + "()"; syn String CfgBranch.branchLabel(); eq CfgStatementBranch.branchLabel() = getHostStatement().branchLabel(); @@ -132,19 +131,22 @@ aspect PrintCfg { syn String ConditionalExpr.branchLabel() = "if (" + getCondition().prettyPrint() + ")"; - inh String CfgMarker.markerName(); - eq BreakStmt.marker().markerName() = "break"; - eq ContinueStmt.marker().markerName() = "continue"; - eq ConditionalExpr.thenEndMarker().markerName() = "then-end"; - eq ConditionalExpr.elseEndMarker().markerName() = "else-end"; - eq IfStmt.thenEndMarker().markerName() = "then-end"; - eq IfStmt.elseEndMarker().markerName() = "else-end"; - eq ReturnStmt.marker().markerName() = "return"; - eq TryStmt.tryEntryMarker().markerName() = "try"; - eq Program.getChild().markerName() = "marker"; + syn String CfgMarker.markerName() = "marker"; + eq CfgBreakStmtMarker.markerName() = "break"; + eq CfgContinueStmtMarker.markerName() = "continue"; + eq CfgThenEndMarker.markerName() = "then-end"; + eq CfgElseEndMarker.markerName() = "else-end"; + eq CfgReturnStmtMarker.markerName() = "return"; + eq CfgTryEntryMarker.markerName() = "try"; + eq CfgLoopEndMarker.markerName() = getLoop.markerName(); + // eq Dot.nullableDereferenceMarker().markerName() = "nullable access"; - eq ForStmt.loopEndMarker().markerName() = "for-end"; - eq EnhancedForStmt.loopEndMarker().markerName() = "for-end"; - eq WhileStmt.loopEndMarker().markerName() = "while-end"; - eq DoStmt.doEntryMarker().markerName() = "do-entry"; + + syn String BranchTargetStmt.markerName() = "marker"; + eq DoStmt.markerName() = "do-entry"; + eq EnhancedForStmt.markerName() = "for-end"; + eq ForStmt.markerName() = "for-end"; + eq SwitchStmt.markerName() = "switch-end"; + eq WhileStmt.markerName() = "while-end"; + } diff --git a/reusablecfg/src/main/jastadd/PrintCfgTest.jrag b/reusablecfg/src/main/jastadd/PrintCfgTest.jrag index 9fe1c1a7f001a3c60dc51484e8cc9373e14a0564..3e8067967f4577457dc517d2535b406648aa356c 100644 --- a/reusablecfg/src/main/jastadd/PrintCfgTest.jrag +++ b/reusablecfg/src/main/jastadd/PrintCfgTest.jrag @@ -150,7 +150,7 @@ aspect PrintCfgTest { eq CfgBranch.varName() = branchKind() + "Branch"; eq CfgException.varName() = "exception"; eq CfgMarker.varName() = markerVarName(); - eq CfgMethodCall.varName() = methodAccess().getID(); + eq CfgMethodCall.varName() = getMethodAccess().getID(); syn String CfgBranch.branchKind(); eq CfgStatementBranch.branchKind() = getHostStatement().branchKind(); diff --git a/reusablecfg/src/main/jastadd/SimpleCFG.jrag b/reusablecfg/src/main/jastadd/SimpleCFG.jrag index 33495b211032aa339e72357bf92dd3684c04e368..3bb6fc3afbd3376f98da218e66e5cbff51896870 100644 --- a/reusablecfg/src/main/jastadd/SimpleCFG.jrag +++ b/reusablecfg/src/main/jastadd/SimpleCFG.jrag @@ -51,32 +51,49 @@ aspect SimpleCFG { eq CfgExit.successors() = Collections.emptySet(); - eq CfgMethodCall.successors() = succ(); + eq CfgMethodCall.successors(); - eq CfgBranch.successors() = succ(); + eq CfgBranch.successors(); - eq CfgException.successors() = succ(); + eq CfgException.successors(); - eq CfgMarker.successors() = succ(); + eq CfgMarker.successors(); /** Successors to this branch node. */ syn Set<? extends CfgNode> CfgBranch.succ(); - eq CfgStatementBranch.succ() = getHostStatement().branchSucc(); - eq CfgExpressionBranch.succ() = getHostExpression().branchSucc(); + eq CfgStatementBranch.successors() = getHostStatement().branchSuccessors(); + eq CfgExpressionBranch.successors() = getHostExpression().branchSuccessors(); /** Successors of a Stmt */ - syn Set<? extends CfgNode> Stmt.branchSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.branchSuccessors() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.loopEndMarkerSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.thenEndMarkerSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.elseEndMarkerSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.doEntryMarkerSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.markerSucc() = Collections.emptySet(); + syn Set<? extends CfgNode> Stmt.tryEntryMarkerSucc() = Collections.emptySet(); /** Successors of a Stmt */ - syn Set<? extends CfgNode> ConditionalExpr.branchSucc(); + syn Set<? extends CfgNode> ConditionalExpr.branchSuccessors(); /** Successors to this method call node. */ - inh Set<? extends CfgNode> CfgMethodCall.succ(); + syn Set<? extends CfgNode> CfgMethodCall.succ() = getMethodAccess().callSuccessors(); - inh Set<? extends CfgNode> CfgException.succ(); + /** Successors of a MethodAccess */ + syn Set<? extends CfgNode> MethodAccess.callSuccessors(); + + syn Set<? extends CfgNode> CfgException.succ(); + + syn Set<? extends CfgNode> CfgMarker.succ(); + eq CfgLoopEndMarker.succ() = getLoop().markerSucc(); + eq CfgThenEndMarker.succ() = getIfStmt().markerSucc(); + eq CfgElseEndMarker.succ() = getIfStmt().markerSucc(); + eq CfgTryEntryMarker.succ() = getTryStmt().markerSucc(); + eq CfgBreakStmtMarker.succ() = getBreakStmt().markerSucc(); + eq CfgContinueStmtMarker.succ() = getContinueStmt().markerSucc(); + eq CfgReturnStmtMarker.succ() = getreturnStmt().markerSucc(); - inh Set<? extends CfgNode> CfgMarker.succ(); /** Build a small set with two elements. */ public <T> Set<T> ASTNode.smallSet(T a, T b) { @@ -94,9 +111,7 @@ aspect SimpleCFG { * Find the next CFG node representing the next branch, or the next * method access following this statement. */ - inh CfgNode Stmt.follow(); - - inh CfgNode Expr.follow(); + syn CfgNode CfgNode.follow(); // Needed for completeness, but never used by anything relevant. eq Program.getChild().follow() = new CfgExit(); @@ -171,9 +186,9 @@ aspect SimpleCFG { * The entry of a try statement has a branch to the block and to each * catch clause or finally block. */ - syn nta CfgMarker TryStmt.tryEntryMarker() = new CfgMarker(); + syn lazy CfgMarker TryStmt.tryEntryMarker() = new CfgMarker(); - eq TryStmt.tryEntryMarker().succ() = + eq TryStmt.tryEntryMarkerSucc() = joinSets(Collections.singleton(getBlock().entry()), catchBranches()); eq MethodAccess.exceptionNode().succ() = exceptionBranches(); @@ -247,14 +262,14 @@ aspect SimpleCFG { : follow(); /** The CFG marker for this break statement. */ - syn nta CfgMarker BreakStmt.marker() = new CfgMarker(); + syn lazy CfgMarker BreakStmt.marker() = new CfgMarker(); eq BreakStmt.entry() = marker(); - eq BreakStmt.marker().succ() = + eq BreakStmt.markerSucc() = hasFinally() ? Collections.singleton(getFinally().entry()) : Collections.singleton(targetStmt().follow()); - eq BreakStmt.marker().follow() = + eq BreakStmt.markerFollow() = hasFinally() ? getFinally().entry() : targetStmt().follow(); @@ -262,14 +277,14 @@ aspect SimpleCFG { eq BreakStmt.getFinally().follow() = targetStmt().follow(); /** The CFG marker for this continue statement. */ - syn nta CfgMarker ContinueStmt.marker() = new CfgMarker(); + syn lazy CfgMarker ContinueStmt.marker() = new CfgMarker(); eq ContinueStmt.entry() = marker(); - eq ContinueStmt.marker().succ() = + eq ContinueStmt.markerSucc() = hasFinally() ? Collections.singleton(getFinally().entry()) : Collections.singleton(targetStmt().entry()); - eq ContinueStmt.marker().follow() = + eq ContinueStmt.markerFollow() = hasFinally() ? getFinally().entry() : targetStmt().entry(); @@ -277,14 +292,14 @@ aspect SimpleCFG { eq ContinueStmt.getFinally().follow() = targetStmt().follow(); /** The CFG marker for this continue statement. */ - syn nta CfgMarker ReturnStmt.marker() = new CfgMarker(); + syn lazy CfgMarker ReturnStmt.marker() = new CfgMarker(); eq ReturnStmt.entry() = marker(); - eq ReturnStmt.marker().succ() = + eq ReturnStmt.markerSucc() = hasResult() ? Collections.singleton(getResult().entry()) : Collections.singleton(returnTarget()); - eq ReturnStmt.marker().follow() = + eq ReturnStmt.markerFollow() = hasResult() ? getResult().entry() : returnTarget(); @@ -320,16 +335,16 @@ aspect SimpleCFG { * This node represents the control flow path taken when an exception * interrupts the call. */ - syn nta CfgException MethodAccess.exceptionNode() = new CfgException(); + syn lazy CfgException MethodAccess.exceptionNode() = new CfgException(); /** This node represents the control flow following the exception. */ - syn nta CfgException ThrowStmt.exceptionNode() = new CfgException(); + syn lazy CfgException ThrowStmt.exceptionNode() = new CfgException(); /** * This node represents the control flow path taken if an exception * is thrown in the start of a try statement. */ - syn nta CfgException TryStmt.exceptionNode() = new CfgException(); + syn lazy CfgException TryStmt.exceptionNode() = new CfgException(); eq ExprStmt.entry() = getExpr().entry(); @@ -364,9 +379,13 @@ aspect SimpleCFG { eq ExprMethodReference.entry() = getExpr().entry(); /** The method call node for this method access. */ - syn nta CfgMethodCall MethodAccess.call() = new CfgMethodCall(); + syn lazy CfgMethodCall MethodAccess.call() { + CfgMethodCall call = new CfgMethodCall(); + call.setMethodAccess(this); + return call; + } - eq MethodAccess.call().succ() = + eq MethodAccess.callSuccessors() = isInsideTryBlockOrResource() ? smallSet(exceptionNode(), follow()) : Collections.singleton(follow()); @@ -459,24 +478,24 @@ aspect SimpleCFG { * The then-end node is a marker node marking the end of a then-branch in a conditional * expression. */ - syn nta CfgMarker ConditionalExpr.thenEndMarker() = new CfgMarker(); + syn lazy CfgMarker ConditionalExpr.thenEndMarker() = new CfgMarker(); /** * The else-end node is a marker node marking the end of a else-branch in a conditional * expression. */ - syn nta CfgMarker ConditionalExpr.elseEndMarker() = new CfgMarker(); + syn lazy CfgMarker ConditionalExpr.elseEndMarker() = new CfgMarker(); eq ConditionalExpr.entry() = getCondition().entry(); eq ConditionalExpr.getCondition().follow() = branch(); eq ConditionalExpr.getTrueExpr().follow() = thenEndMarker(); eq ConditionalExpr.getFalseExpr().follow() = elseEndMarker(); - eq ConditionalExpr.thenEndMarker().follow() = follow(); - eq ConditionalExpr.elseEndMarker().follow() = follow(); - eq ConditionalExpr.thenEndMarker().succ() = Collections.singleton(follow()); - eq ConditionalExpr.elseEndMarker().succ() = Collections.singleton(follow()); + eq ConditionalExpr.thenEndMarkerFollow() = follow(); + eq ConditionalExpr.elseEndMarkerFollow() = follow(); + eq ConditionalExpr.thenEndMarkerSucc() = Collections.singleton(follow()); + eq ConditionalExpr.elseEndMarkerSucc() = Collections.singleton(follow()); - eq ConditionalExpr.branchSucc() = + eq ConditionalExpr.successors() = smallSet(getTrueExpr().entry(), getFalseExpr().entry()); /** The branch node for this statement. */ @@ -487,22 +506,22 @@ aspect SimpleCFG { } /** The then-end node is a marker node marking the end of a then-branch in an if statement. */ - syn nta CfgMarker IfStmt.thenEndMarker() = new CfgMarker(); + syn lazy CfgMarker IfStmt.thenEndMarker() = new CfgMarker(); /** The else-end node is a marker node marking the end of a else-branch in an if statement. */ - syn nta CfgMarker IfStmt.elseEndMarker() = new CfgMarker(); + syn lazy CfgMarker IfStmt.elseEndMarker() = new CfgMarker(); eq IfStmt.entry() = getCondition().entry(); eq IfStmt.getCondition().follow() = branch(); eq IfStmt.getThen().follow() = thenEndMarker(); eq IfStmt.getElse().follow() = elseEndMarker(); - eq IfStmt.thenEndMarker().follow() = follow(); - eq IfStmt.elseEndMarker().follow() = follow(); - eq IfStmt.thenEndMarker().succ() = Collections.singleton(follow()); - eq IfStmt.elseEndMarker().succ() = Collections.singleton(follow()); + eq IfStmt.thenEndMarkerFollow() = follow(); + eq IfStmt.elseEndMarkerFollow() = follow(); + eq IfStmt.thenEndMarkerSucc() = Collections.singleton(follow()); + eq IfStmt.elseEndMarkerSucc() = Collections.singleton(follow()); - eq IfStmt.branchSucc() = + eq IfStmt.successors() = hasElse() ? smallSet(getThen().entry(), getElse().entry()) : smallSet(getThen().entry(), follow()); @@ -515,7 +534,7 @@ aspect SimpleCFG { } /** The CFG end marker for this loop. */ - syn nta CfgMarker ForStmt.loopEndMarker() = new CfgMarker(); + syn lazy CfgMarker ForStmt.loopEndMarker() = new CfgMarker(); eq ForStmt.entry() = getNumInitStmt() > 0 @@ -536,17 +555,17 @@ aspect SimpleCFG { eq ForStmt.getStmt().follow() = loopEndMarker(); - eq ForStmt.loopEndMarker().follow() = + eq ForStmt.loopEndMarkerFollow() = getNumUpdateStmt() > 0 ? getUpdateStmt(0).entry() : getCondition().entry(); - eq ForStmt.loopEndMarker().succ() = + eq ForStmt.loopEndMarkerSucc() = getNumUpdateStmt() > 0 ? Collections.singleton(getUpdateStmt(0).entry()) : Collections.singleton(getCondition().entry()); - eq ForStmt.branchSucc() { + eq ForStmt.branchSuccessors() { if (getCondition().isTrue()) { return Collections.singleton(getStmt().entry()); } else if (getCondition().isFalse()) { @@ -564,9 +583,9 @@ aspect SimpleCFG { } /** The CFG end marker for this loop. */ - syn nta CfgMarker EnhancedForStmt.loopEndMarker() = new CfgMarker(); + syn lazy CfgMarker EnhancedForStmt.loopEndMarker() = new CfgMarker(); - eq EnhancedForStmt.branchSucc() = smallSet(getStmt().entry(), follow()); + eq EnhancedForStmt.branchSuccessors() = smallSet(getStmt().entry(), follow()); eq EnhancedForStmt.entry() = getExpr().entry(); @@ -574,9 +593,9 @@ aspect SimpleCFG { eq EnhancedForStmt.getStmt().follow() = loopEndMarker(); - eq EnhancedForStmt.loopEndMarker().follow() = entry(); // Loop back. + eq EnhancedForStmt.loopEndMarkerfollow() = entry(); // Loop back. - eq EnhancedForStmt.loopEndMarker().succ() = Collections.singleton(entry()); + eq EnhancedForStmt.loopEndMarkerSucc() = Collections.singleton(entry()); /** The branch node for this statement. */ syn lazy CfgStatementBranch WhileStmt.branch() { @@ -586,7 +605,7 @@ aspect SimpleCFG { } /** The CFG end marker for this loop. */ - syn nta CfgMarker WhileStmt.loopEndMarker() = new CfgMarker(); + syn lazy CfgMarker WhileStmt.loopEndMarker() = new CfgMarker(); eq WhileStmt.entry() = getCondition().entry(); @@ -594,11 +613,11 @@ aspect SimpleCFG { eq WhileStmt.getStmt().follow() = loopEndMarker(); - eq WhileStmt.loopEndMarker().follow() = entry(); // Loop back. + eq WhileStmt.loopEndMarkerFollow() = entry(); // Loop back. - eq WhileStmt.loopEndMarker().succ() = Collections.singleton(entry()); + eq WhileStmt.loopEndMarkerSucc() = Collections.singleton(entry()); - eq WhileStmt.branchSucc() { + eq WhileStmt.branchSuccessors() { if (getCondition().isTrue()) { return Collections.singleton(getStmt().entry()); } else if (getCondition().isFalse()) { @@ -616,20 +635,20 @@ aspect SimpleCFG { } /** The CFG entry marker for this loop. */ - syn nta CfgMarker DoStmt.doEntryMarker() = new CfgMarker(); + syn lazy CfgMarker DoStmt.doEntryMarker() = new CfgMarker(); eq DoStmt.entry() = doEntryMarker(); - eq DoStmt.doEntryMarker().follow() = getStmt().entry(); + eq DoStmt.doEntryMarkerFollow() = getStmt().entry(); - eq DoStmt.doEntryMarker().succ() = Collections.singleton(getStmt().entry()); + eq DoStmt.doEntryMarkerSucc() = Collections.singleton(getStmt().entry()); eq DoStmt.getStmt().follow() = getCondition().entry(); eq DoStmt.getCondition().follow() = branch(); // Loop back. - eq DoStmt.branchSucc() { + eq DoStmt.branchSuccessors() { if (getCondition().isTrue()) { return Collections.singleton(entry()); } else if (getCondition().isFalse()) { @@ -649,7 +668,7 @@ aspect SimpleCFG { eq SwitchStmt.getExpr().follow() = branch(); - eq SwitchStmt.branchSucc() { + eq SwitchStmt.branchSuccessors() { Set<CfgNode> set = Collections.newSetFromMap( new IdentityHashMap<CfgNode, Boolean>()); boolean hasDefault = false; @@ -683,10 +702,6 @@ aspect SimpleCFG { eq BlockLambdaBody.getBlock().follow() = exit(); eq ExprLambdaBody.getExpr().follow() = exit(); - /** Find the method access which this call node is associated with. */ - inh MethodAccess CfgMethodCall.methodAccess(); - eq MethodAccess.call().methodAccess() = this; - /** Find the entry node to the CFG this statement belongs to. */ inh lazy CfgEntry Stmt.cfg(); inh lazy CfgEntry Expr.cfg(); diff --git a/reusablecfg/src/main/jastadd/SimpleCfgNta.jrag b/reusablecfg/src/main/jastadd/SimpleCfgNta.jrag new file mode 100644 index 0000000000000000000000000000000000000000..192783abc0e211cfab95703516afff860f9bc841 --- /dev/null +++ b/reusablecfg/src/main/jastadd/SimpleCfgNta.jrag @@ -0,0 +1,20 @@ +aspect JavaToCfg { + +// /** +// * Successor nodes in the CFG. +// */ +// syn lazy Set<? extends CfgNode> CfgNode.successors(); +// +// eq CfgEntry.successors() = Collections.singleton(getSucc()); +// +// eq CfgExit.successors() = Collections.emptySet(); +// +// eq CfgMethodCall.successors() = succ(); +// +// eq CfgBranch.successors() = succ(); +// +// eq CfgException.successors() = succ(); +// +// eq CfgMarker.successors() = succ(); + +}