Class CallGraph

    • Constructor Detail

      • CallGraph

        public CallGraph()
    • Method Detail

      • init

        public void init​(Application app)
                  throws CallGraphConstructionException
        Initializes the call graph of the given program. A call to this method should effectively re-initialize the call graph as if it is yet to be used. This is useful when the same instance is used in multiple analyses.
        Parameters:
        app - the application to analyze
        Throws:
        CallGraphConstructionException - if an exception happens while building the call graph
      • resolve

        public abstract Call resolve​(UnresolvedCall call,
                                     java.util.Set<Type>[] types,
                                     SymbolAliasing aliasing)
                              throws CallResolutionException
        Yields a Call implementation that corresponds to the resolution of the given UnresolvedCall.
        Parameters:
        call - the call to resolve
        types - the runtime types of the parameters of the call
        aliasing - the symbol aliasing information, might be null
        Returns:
        a collection of all the possible runtime targets
        Throws:
        CallResolutionException - if this call graph is unable to resolve the given call
      • registerCall

        public abstract void registerCall​(CFGCall call)
        Registers an already resolved CFGCall in this CallGraph.
        Parameters:
        call - the call to register
      • getCallSites

        public abstract java.util.Collection<Call> getCallSites​(CodeMember cm)
        Yields all the Calls that target the given CodeMember. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cm - the target code member
        Returns:
        the collection of calls that target the code member
      • getCallSites

        public java.util.Collection<Call> getCallSites​(java.util.Collection<? extends CodeMember> cms)
        Yields all the Calls that target at least one of the given CodeMembers. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cms - the target code members
        Returns:
        the collection of calls that target the code members
      • getCallers

        public java.util.Collection<CodeMember> getCallers​(java.util.Collection<? extends CodeMember> cms)
        Yields all the CodeMembers that call the given ones. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cms - the target code members
        Returns:
        the collection of callers code members
      • getCallersTransitively

        public java.util.Collection<CodeMember> getCallersTransitively​(CodeMember cm)
        Yields the transitive closure of getCallers(CodeMember). The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cm - the target code member
        Returns:
        the collection of callers code members computed transitively
      • getCallersTransitively

        public java.util.Collection<CodeMember> getCallersTransitively​(java.util.Collection<? extends CodeMember> cms)
        Yields the transitive closure of getCallers(CodeMember) over each given code member. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cms - the target code members
        Returns:
        the collection of callers code members computed transitively
      • getCallees

        public java.util.Collection<CodeMember> getCallees​(java.util.Collection<? extends CodeMember> cms)
        Yields all the CodeMembers that are called by the given ones. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cms - the target code members
        Returns:
        the collection of callees code members
      • getCalleesTransitively

        public java.util.Collection<CodeMember> getCalleesTransitively​(CodeMember cm)
        Yields the transitive closure of getCallees(CodeMember). The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cm - the target code member
        Returns:
        the collection of callees code members computed transitively
      • getCalleesTransitively

        public java.util.Collection<CodeMember> getCalleesTransitively​(java.util.Collection<? extends CodeMember> cms)
        Yields the transitive closure of getCallees(CodeMember) of each given code member. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cms - the target code members
        Returns:
        the collection of callees code members computed transitively
      • getCallees

        public java.util.Collection<CodeMember> getCallees​(CodeMember cm)
        Yields all the CodeMembers that are called by the given one. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cm - the target code member
        Returns:
        the collection of called code members
      • getCallers

        public java.util.Collection<CodeMember> getCallers​(CodeMember cm)
        Yields all the CodeMembers that call the given one. The returned collection might contain partial results if this call graph is not fully built.
        Parameters:
        cm - the target code member
        Returns:
        the collection of callers code members
      • getRecursions

        public java.util.Collection<java.util.Collection<CodeMember>> getRecursions()
        Yields all the recursions that happens in the program, in the form of collections of the CodeMembers composing them.
        Returns:
        the recursions
      • getRecursionsContaining

        public java.util.Collection<java.util.Collection<CodeMember>> getRecursionsContaining​(CodeMember cm)
        Yields all the recursions happening in the program, in the form of collections of the CodeMembers composing them, containing the given code member.
        Parameters:
        cm - the target code member
        Returns:
        the recursions