com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneCFABuilder()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(19.9k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneCFABuilder()方法的一些代码示例,展示了Util.makeZeroOneCFABuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.makeZeroOneCFABuilder()方法的具体详情如下:
包路径:com.ibm.wala.ipa.callgraph.impl.Util
类名称:Util
方法名:makeZeroOneCFABuilder

Util.makeZeroOneCFABuilder介绍

暂无

代码示例

代码示例来源:origin: com.ibm.wala/com.ibm.wala.core

/**
 * @return a 0-1-CFA Call Graph Builder.
 * 
 * @param options options that govern call graph construction
 * @param cha governing class hierarchy
 * @param scope representation of the analysis scope
 */
public static SSAPropagationCallGraphBuilder makeZeroOneCFABuilder(Language l, AnalysisOptions options, IAnalysisCacheView cache,
  IClassHierarchy cha, AnalysisScope scope) {
 return makeZeroOneCFABuilder(l, options, cache, cha, scope, null, null);
}

代码示例来源:origin: wala/WALA

/**
 * @return a 0-1-CFA Call Graph Builder.
 * 
 * @param options options that govern call graph construction
 * @param cha governing class hierarchy
 * @param scope representation of the analysis scope
 */
public static SSAPropagationCallGraphBuilder makeZeroOneCFABuilder(Language l, AnalysisOptions options, IAnalysisCacheView cache,
  IClassHierarchy cha, AnalysisScope scope) {
 return makeZeroOneCFABuilder(l, options, cache, cha, scope, null, null);
}

代码示例来源:origin: wala/WALA

public static CallGraph buildZeroOneCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope,
  boolean testPAtoString) throws IllegalArgumentException, CancelException {
 StopwatchGC S = null;
 if (CHECK_FOOTPRINT) {
  S = new StopwatchGC("build RTA graph");
  S.start();
 }
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 if (testPAtoString) {
  builder.getPointerAnalysis().toString();
 }
 if (CHECK_FOOTPRINT) {
  S.stop();
  System.err.println(S.report());
 }
 return cg;
}

代码示例来源:origin: wala/WALA

@Test
public void testSlice5() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE5_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode n = findMethod(cg, "baz");
 Statement s = findCallTo(n, "foo");
 s = PDFSlice.getReturnStatementForCall(s);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis,
   DataDependenceOptions.FULL, ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 7, slice.size());
}

代码示例来源:origin: wala/WALA

@Test
public void testSlice4() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE4_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallTo(main, "foo");
 s = PDFSlice.getReturnStatementForCall(s);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 4, slice.size());
}

代码示例来源:origin: wala/WALA

@Test
public void testTestCD1() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTCD1);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.NONE,
   ControlDependenceOptions.FULL);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 2, countConditionals(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestCD3() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTCD3);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.NONE,
   ControlDependenceOptions.FULL);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 0, countConditionals(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestFields() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTFIELDS);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 2, countAllocations(slice));
 Assert.assertEquals(slice.toString(), 1, countPutfields(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestRecursion() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTRECURSION);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 3, countAllocations(slice));
 Assert.assertEquals(slice.toString(), 2, countPutfields(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestArrays() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTARRAYS);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 2, countAllocations(slice));
 Assert.assertEquals(slice.toString(), 1, countAloads(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestCD2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTCD2);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.NONE,
   ControlDependenceOptions.FULL);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 1, countConditionals(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestCD6() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTCD6);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = new MethodEntryStatement(main);
 System.err.println("Statement: " + s);
 // compute a no-data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis,
   DataDependenceOptions.NONE, ControlDependenceOptions.NO_EXCEPTIONAL_EDGES);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 2, countInvokes(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE2_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMethod(cg, "baz");
 Statement s = findCallTo(main, "println");
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> computeBackwardSlice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis,
   DataDependenceOptions.FULL, ControlDependenceOptions.NONE);
 Collection<Statement> slice = computeBackwardSlice;
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 9, countNormals(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestMultiTarget() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTMULTITARGET);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 2, countAllocations(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testSlice3() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE3_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMethod(cg, "main");
 Statement s = findCallTo(main, "doNothing");
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 1, countAllocations(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testTestId() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTID);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NONE);
 dumpSlice(slice);
 Assert.assertEquals(slice.toString(), 1, countAllocations(slice));
}

代码示例来源:origin: wala/WALA

@Test
public void testJustThrow() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_JUSTTHROW);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NO_EXCEPTIONAL_EDGES);
 dumpSlice(slice);
}

代码示例来源:origin: wala/WALA

@Test
public void testTestCD5() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTCD5);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = new MethodEntryStatement(main);
 System.err.println("Statement: " + s);
 // compute a no-data slice
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis,
   DataDependenceOptions.NONE, ControlDependenceOptions.NO_EXCEPTIONAL_EDGES);
 dumpSlice(slice);
 Assert.assertEquals(10, slice.size());
 Assert.assertEquals(3, countReturns(slice));
}

代码示例来源:origin: wala/WALA

/**
 * test for bug reported on mailing list by Joshua Garcia, 5/16/2010
 */
@Test
public void testTestInetAddr() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, UnsoundGraphException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE_TESTINETADDR);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 SDG<?> sdg = new SDG<>(cg, builder.getPointerAnalysis(), DataDependenceOptions.NO_BASE_NO_HEAP, ControlDependenceOptions.FULL);
 GraphIntegrity.check(sdg);
}

代码示例来源:origin: wala/WALA

@Test
public void testSlice9() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 IClassHierarchy cha = findOrCreateCHA(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
   TestConstants.SLICE9_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 CGNode main = findMainMethod(cg);
 Statement s = findCallToDoNothing(main);
 System.err.println("Statement: " + s);
 // compute a backward slice, with data dependence and no exceptional control dependence
 final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis();
 Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL,
   ControlDependenceOptions.NO_EXCEPTIONAL_EDGES);
 //dumpSlice(slice);
 Assert.assertEquals(/*slice.toString(), */5, countApplicationNormals(slice));
}

相关文章