private static DefinitelyDerefedParams getAnalysisDriver( IMethod mtd, AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha) { IR ir = cache.getIRFactory().makeIR(mtd, Everywhere.EVERYWHERE, options.getSSAOptions()); ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = ir.getControlFlowGraph(); accountCodeBytes(mtd); return new DefinitelyDerefedParams(mtd, ir, cfg, cha); }
scope.setExclusions( new FileOfClasses( new ByteArrayInputStream(DEFAULT_EXCLUSIONS.getBytes(StandardCharsets.UTF_8)))); if (jarIS != null) scope.addInputStreamForJarToScope(ClassLoaderReference.Application, jarIS); else AnalysisScopeReader.addClassPathToScope(inPath, scope, ClassLoaderReference.Application); AnalysisOptions options = new AnalysisOptions(scope, null); AnalysisCache cache = new AnalysisCacheImpl(); IClassHierarchy cha = ClassHierarchyFactory.makeWithPhantom(scope); Warnings.clear();
@Override public IR getIR(CGNode node) { // new Exception("getting IR for method "+node.getMethod().getReference().toString()).printStackTrace(); return cache.getIR(node.getMethod(), node.getContext()); }
@Override public boolean understands(CGNode node) { return isFindStatic(node) && node.getContext().isA(FindContext.class); }
@Override public IR getIR(CGNode node) { assert understands(node); @SuppressWarnings("unchecked") ContextItem.Value<Boolean> isNonNullArray = (ContextItem.Value<Boolean>) node.getContext().get(JavaScriptFunctionApplyContextSelector.APPLY_NON_NULL_ARGS); // isNonNullArray can be null if, e.g., due to recursion bounding we have no // information on the arguments parameter if (isNonNullArray == null || isNonNullArray.getValue()) { return makeIRForArgList(node); } else { return makeIRForNoArgList(node); } }
/** * Create and compute intraprocedural exception analysis. (IR from * node.getIR() will be used.) */ public IntraproceduralExceptionAnalysis(CGNode node, ExceptionFilter<SSAInstruction> filter, ClassHierarchy cha, PointerAnalysis<InstanceKey> pointerAnalysis) { this(node.getIR(), filter, cha, pointerAnalysis, node); }
/** * Return the information regarding the primordial loader. */ public ClassLoaderReference getPrimordialLoader() { return getLoader(PRIMORDIAL); }
/** * Compute the lexical variables possibly read by each {@link CGNode} and its * transitive callees. A lexical variable is represented as a pair (C,N), * where C is the defining {@link CGNode} and N is the {@link String} name. */ public Map<CGNode, OrdinalSet<Pair<CGNode, String>>> computeLexicalRef() { Map<CGNode, Collection<Pair<CGNode, String>>> scan = CallGraphTransitiveClosure.collectNodeResults(cg, this::scanNodeForLexReads); return CallGraphTransitiveClosure.transitiveClosure(cg, scan); }
/** * @throws IllegalArgumentException if cg is null */ public static String getStats(CallGraph cg) { return getCGStats(cg).toString(); }
ClassHierarchy(AnalysisScope scope, ClassLoaderFactory factory, IProgressMonitor progressMonitor, Map<TypeReference, Node> map, MissingSuperClassHandling superClassHandling) throws ClassHierarchyException, IllegalArgumentException { this(scope, factory, scope.getLanguages(), progressMonitor, map, superClassHandling); }
@Override public IR getIR(CGNode node) { // new Exception("getting IR for method "+node.getMethod().getReference().toString()).printStackTrace(); return cache.getIR(node.getMethod(), node.getContext()); }
@Override public boolean understands(CGNode node) { return (isInvoke(node) || isType(node)) && node.getContext().isA(MethodContext.class); }
/** * Return the information regarding the application loader. */ public ClassLoaderReference getSyntheticLoader() { return getLoader(SYNTHETIC); }
/** * Compute the lexical variables possibly read by each {@link CGNode} and its * transitive callees. A lexical variable is represented as a pair (C,N), * where C is the defining {@link CGNode} and N is the {@link String} name. */ public Map<CGNode, OrdinalSet<Pair<CGNode, String>>> computeLexicalRef() { Map<CGNode, Collection<Pair<CGNode, String>>> scan = CallGraphTransitiveClosure.collectNodeResults(cg, this::scanNodeForLexReads); return CallGraphTransitiveClosure.transitiveClosure(cg, scan); }
/** * @throws IllegalArgumentException if cg is null */ public static String getStats(CallGraph cg) { return getCGStats(cg).toString(); }
ClassHierarchy(AnalysisScope scope, ClassLoaderFactory factory, IProgressMonitor progressMonitor, Map<TypeReference, Node> map, MissingSuperClassHandling superClassHandling) throws ClassHierarchyException, IllegalArgumentException { this(scope, factory, scope.getLanguages(), progressMonitor, map, superClassHandling); }
@Override public boolean understands(CGNode node) { return isFindStatic(node) && node.getContext().isA(FindContext.class); }
@Override public boolean understands(CGNode node) { return (isInvoke(node) || isType(node)) && node.getContext().isA(MethodContext.class); }