@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
37 lines (36 loc) • 2.41 kB
TypeScript
import { type QuadSerializationConfiguration } from '../util/quads';
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { DataflowGraph } from '../dataflow/graph/graph';
import type { DataflowGraphVertexFunctionCall } from '../dataflow/graph/vertex';
import { CfgVertex, type ControlFlowInformation } from './control-flow-graph';
import { type CfgSimplificationPassName } from './cfg-simplification';
import type { ReadOnlyFlowrAnalyzerContext } from '../project/context/flowr-analyzer-context';
/**
* Given a normalized AST, this approximates the control flow graph of the program.
* This view is different from the computation of the dataflow graph and may differ,
* especially because it focuses on intra-procedural analysis.
* @param ast - the normalized AST
* @param ctx - the flowR context
* @param graph - additional dataflow facts to consider by the control flow extraction
* @param simplifications - a list of simplification passes to apply to the control flow graph
* @param ignoreFunctDefs - whether function definition vertices should be ignored
* @see {@link extractCfgQuick} - for a simplified version of this function
*/
export declare function extractCfg<Info = ParentInformation>(ast: NormalizedAst<Info & ParentInformation>, ctx: ReadOnlyFlowrAnalyzerContext, graph?: DataflowGraph, simplifications?: readonly CfgSimplificationPassName[], ignoreFunctDefs?: boolean): ControlFlowInformation;
/**
* A version of {@link extractCfg} that is much quicker and does not apply any simplifications or dataflow information.
*/
export declare function extractCfgQuick<Info = ParentInformation>(ast: NormalizedAst<Info>): ControlFlowInformation<CfgVertex>;
/**
* Extracts all function call vertices from the given control flow information and dataflow graph.
*/
export declare function getCallsInCfg(cfg: ControlFlowInformation, graph: DataflowGraph): Map<NodeId, Required<DataflowGraphVertexFunctionCall>>;
export declare const ResolvedCallSuffix: "-resolved-call-e";
/**
* Convert a cfg to RDF quads.
* @see {@link df2quads}
* @see {@link serialize2quads}
* @see {@link graph2quads}
*/
export declare function cfg2quads(cfg: ControlFlowInformation, config: QuadSerializationConfiguration): string;