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

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

本文整理了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

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

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

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

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

  1. public static CallGraph buildZeroOneCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope,
  2. boolean testPAtoString) throws IllegalArgumentException, CancelException {
  3. StopwatchGC S = null;
  4. if (CHECK_FOOTPRINT) {
  5. S = new StopwatchGC("build RTA graph");
  6. S.start();
  7. }
  8. CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope);
  9. CallGraph cg = builder.makeCallGraph(options, null);
  10. if (testPAtoString) {
  11. builder.getPointerAnalysis().toString();
  12. }
  13. if (CHECK_FOOTPRINT) {
  14. S.stop();
  15. System.err.println(S.report());
  16. }
  17. return cg;
  18. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章