1 19 20 package soot.dava.toolkits.base.finders; 21 22 import soot.*; 23 import java.util.*; 24 import soot.util.*; 25 import soot.dava.*; 26 import soot.dava.internal.asg.*; 27 import soot.dava.internal.SET.*; 28 import soot.dava.internal.AST.*; 29 import soot.dava.internal.javaRep.*; 30 31 public class AbruptEdgeFinder implements FactFinder 32 { 33 public AbruptEdgeFinder( Singletons.Global g ) {} 34 public static AbruptEdgeFinder v() { return G.v().soot_dava_toolkits_base_finders_AbruptEdgeFinder(); } 35 36 public void find( DavaBody body, AugmentedStmtGraph asg, SETNode SET) throws RetriggerAnalysisException 37 { 38 Dava.v().log( "AbruptEdgeFinder::find()"); 39 40 SET.find_AbruptEdges( this); 41 } 42 43 public void find_Continues( SETNode SETParent, IterableSet body, IterableSet children) 44 { 45 if ((SETParent instanceof SETCycleNode) == false) 46 return; 47 48 SETCycleNode scn = (SETCycleNode) SETParent; 49 IterableSet naturalPreds = ((SETNode) children.getLast()).get_NaturalExits(); 50 51 Iterator pit = scn.get_CharacterizingStmt().bpreds.iterator(); 52 while (pit.hasNext()) { 53 AugmentedStmt pas = (AugmentedStmt) pit.next(); 54 55 if ((body.contains( pas)) && (naturalPreds.contains( pas) == false)) 56 ((SETStatementSequenceNode) pas.myNode).insert_AbruptStmt( new DAbruptStmt( "continue", scn.get_Label())); 57 } 58 } 59 60 public void find_Breaks( SETNode prev, SETNode cur) 61 { 62 IterableSet naturalPreds = prev.get_NaturalExits(); 63 64 Iterator pit = cur.get_EntryStmt().bpreds.iterator(); 65 while (pit.hasNext()) { 66 AugmentedStmt pas = (AugmentedStmt) pit.next(); 67 68 if (prev.get_Body().contains( pas) == false) 69 continue; 70 71 if (naturalPreds.contains( pas) == false) 72 ((SETStatementSequenceNode) pas.myNode).insert_AbruptStmt( new DAbruptStmt( "break", prev.get_Label())); 73 } 74 } 75 } 76 | Popular Tags |