cfg

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package cfg offers a comprehensive toolkit for constructing and visualizing control flow graphs (CFGs) of Solidity smart contracts.

Key Features: - Initialization of CFG builders with context and solgo IR builders. - Seamless integration with the go-graphviz library for graph operations. - Recursive traversal of the IR to build nodes and edges for the CFG. - Capability to render the CFG into various formats including DOT and PNG. - Error handling and resource management for efficient graph operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is responsible for constructing the control flow graph.

func NewBuilder

func NewBuilder(ctx context.Context, builder *ir.Builder) *Builder

NewBuilder initializes a new CFG builder.

func (*Builder) Build

func (b *Builder) Build() (*cgraph.Graph, error)

Build constructs the control flow graph for the given IR.

func (*Builder) Close

func (b *Builder) Close() error

Close releases any resources used by the Graphviz instance.

func (*Builder) GenerateDOT

func (b *Builder) GenerateDOT(graph *cgraph.Graph) (string, error)

GenerateDOT produces the DOT representation of the given graph.

func (*Builder) GetGraphviz

func (b *Builder) GetGraphviz() *graphviz.Graphviz

GetGraphviz returns the underlying Graphviz instance.

func (*Builder) SaveAs

func (b *Builder) SaveAs(graph *cgraph.Graph, format graphviz.Format, file string) error

SaveAs renders the graph to a file in the specified format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL