tokstyle-0.0.9: TokTok C code style checker
Safe HaskellNone
LanguageHaskell2010

Tokstyle.Analysis.CFG

Description

This module provides tools for building a control flow graph (CFG) from C code represented by the Ast.

The core components are:

  • CFG: A control flow graph representation, where nodes contain basic blocks of statements.
  • buildCFG: A function to construct a CFG from a FunctionDefn.

This module is only concerned with the *structure* of the control flow, not with any particular data flow analysis.

Synopsis

Documentation

data CFGNode l Source #

A node in the control flow graph. Each node represents a basic block of statements. It only contains structural information.

Constructors

CFGNode 

Fields

Instances

Instances details
Eq l => Eq (CFGNode l) Source # 
Instance details

Defined in Tokstyle.Analysis.CFG

Methods

(==) :: CFGNode l -> CFGNode l -> Bool #

(/=) :: CFGNode l -> CFGNode l -> Bool #

Show l => Show (CFGNode l) Source # 
Instance details

Defined in Tokstyle.Analysis.CFG

Methods

showsPrec :: Int -> CFGNode l -> ShowS #

show :: CFGNode l -> String #

showList :: [CFGNode l] -> ShowS #

type CFG l = Map Int (CFGNode l) Source #

The Control Flow Graph is a map from node IDs to CFGNodes.

buildCFG :: (Pretty l, Ord l, Show l, IsString l) => Node (Lexeme l) -> CFG l Source #

Build a control flow graph for a function definition. This is the main entry point for constructing a CFG from a Cimple AST.