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

Tokstyle.Analysis.Types

Synopsis

Documentation

type CallGraph = Map FunctionName CalleeMap Source #

The CallGraph is a map from a caller function to its CalleeMap.

data CallSite Source #

A new, richer representation of a call site.

Constructors

CallSite 

Instances

Instances details
Eq CallSite Source # 
Instance details

Defined in Tokstyle.Analysis.Types

Ord CallSite Source # 
Instance details

Defined in Tokstyle.Analysis.Types

Show CallSite Source # 
Instance details

Defined in Tokstyle.Analysis.Types

data CallType Source #

Describes how a function is called.

Constructors

DirectCall 
IndirectCall 

Instances

Instances details
Eq CallType Source # 
Instance details

Defined in Tokstyle.Analysis.Types

Ord CallType Source # 
Instance details

Defined in Tokstyle.Analysis.Types

Show CallType Source # 
Instance details

Defined in Tokstyle.Analysis.Types

type FunctionName = Text Source #

A function name is just Text.

type CalleeMap = Map FunctionName (Set CallSite) Source #

A map from a callee's name to the set of ways it's called.

type PointsToMap = Map AbstractLocation (Set AbstractLocation) Source #

The PointsToMap is the data flow fact. It maps a pointer's abstract location to the set of abstract locations it can point to.

type PointsToSummary = Map Context PointsToSummaryData Source #

The full, context-sensitive points-to summary for a function.

getCallers :: CallGraph -> FunctionName -> Map FunctionName (Set CallSite) Source #

Helper function to get all functions that call a given function.

data AbstractLocation Source #

Represents a location where a value can be stored. This allows the analysis to distinguish between different variables and fields.

Constructors

VarLocation Text

A local variable or parameter name.

GlobalVarLocation Text

A global or static variable.

FieldLocation AbstractLocation Text

A struct/union field, e.g., msg.data

DerefLocation AbstractLocation

The memory pointed to by a pointer, e.g., *p

ReturnLocation Text

The return value of a function.

HeapLocation Int

An abstract location on the heap.

FunctionLocation Text

The address of a function.

toAbstractLocation :: HasCallStack => Node (Lexeme Text) -> AbstractLocation Source #

Helper to convert an LHS expression AST node to an AbstractLocation.

type NodeId = Int Source #

A unique identifier for a C AST node.

type Context = [NodeId] Source #

The call-string context, limited to depth k.

lookupOrError :: (Ord k, Show k) => String -> Map k a -> k -> a Source #

A safer version of !.