Skip to main content

module lang::php::analysis::cfg::BuildCFG

rascal-0.43.0
org.rascalmpl.php-analysis-0.3.6

Usage​

import lang::php::analysis::cfg::BuildCFG;

Dependencies​

import lang::php::ast::AbstractSyntax;
import lang::php::analysis::NamePaths;
import lang::php::analysis::cfg::CFG;
import lang::php::analysis::cfg::Label;
import lang::php::analysis::cfg::LabelState;
import lang::php::analysis::cfg::FlowEdge;
import lang::php::analysis::cfg::BasicBlocks;
import lang::php::util::Utils;
import IO;
import List;
import Set;
import Node;
import Relation;

function buildCFGs​

map[loc,CFG] buildCFGs(loc l, bool buildBasicBlocks=true)

Build the CFGs for a single PHP file, given as a location

function buildCFGsAndScript​

tuple[Script scr, map[loc,CFG] cfgs] buildCFGsAndScript(Script scr, bool buildBasicBlocks=true)

Build the CFGs for a PHP script, returning both the CFGs and the labeled script.

function buildCFGs​

map[loc,CFG] buildCFGs(Script scr, bool buildBasicBlocks=true)

Build just the CFGs for a PHP script

function stripLabels​

Script stripLabels(Script scr)

Strip the label annotations off of the nodes in the script.

function getScriptMethods​

map[loc, ClassItem] getScriptMethods(Script scr)

Retrieve all method declarations from a script.

function getScriptFunctions​

map[loc, Stmt] getScriptFunctions(Script scr)

Retrieve all function declarations from a script. Note: this assumes that definitions are unique.

function cleanUpGraph​

tuple[set[CFGNode] nodes, set[FlowEdge] edges] cleanUpGraph(LabelState lstate, set[FlowEdge] edges)

function removeUnrealizablePaths​

set[FlowEdge] removeUnrealizablePaths(set[FlowEdge] edges)

function createScriptCFG​

tuple[CFG scriptCFG, LabelState lstate] createScriptCFG(Script scr, LabelState lstate)

function createMethodCFG​

tuple[CFG methodCFG, LabelState lstate] createMethodCFG(loc np, ClassItem m, LabelState lstate)

function createFunctionCFG​

tuple[CFG functionCFG, LabelState lstate] createFunctionCFG(loc np, Stmt f, LabelState lstate)

function init​

set[Lab] init(Stmt s, LabelState lstate)

set[Lab] init(Expr e, LabelState lstate)

function final​

set[Lab] final(Stmt s, LabelState lstate)

set[Lab] final(Expr e, LabelState lstate)

Find the label of the final step taken in computing the given statement.

function addExpEdges​

tuple[FlowEdges, LabelState] addExpEdges(FlowEdges edges, LabelState lstate, Expr e)

Add internal edges between subexpressions of an expression.

function addStmtEdges​

tuple[FlowEdges, LabelState] addStmtEdges(FlowEdges edges, LabelState lstate, Stmt s)

Add internal edges between internal expressions and statements of a statement.

function addBodyEdges​

tuple[FlowEdges, LabelState] addBodyEdges(FlowEdges edges, LabelState lstate, list[Stmt] body)

Add edges between statements given as a sequence, such as in the bodies of other statements.

function addExpSeqEdges​

tuple[FlowEdges, LabelState] addExpSeqEdges(FlowEdges edges, LabelState lstate, list[Expr] exps)

Add edges between expressions that are given as a sequence.

function internalFlow​

tuple[FlowEdges,LabelState] internalFlow(Stmt s, LabelState lstate)

tuple[FlowEdges,LabelState] internalFlow(Expr e, LabelState lstate)

function collapseExpressions​

CFG collapseExpressions(CFG g)

Collapse expressions, which are unrolled into chains of individual nodes, back into single expression nodes.

function removeChildExpressions​

CFG removeChildExpressions(CFG g)

Remove expression nodes that are children of statement nodes