Skip to content

Commit

Permalink
update cfg section
Browse files Browse the repository at this point in the history
  • Loading branch information
notJoon committed Jul 31, 2024
1 parent fd2cff9 commit 5b59bf3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ The output will show:

Use this feature to identify complex parts of your codebase that might benefit from refactoring.

## Control Flow Graph (CFG) [Experimental]

tlin supports generating control flow graphs (CFG) for functions, A CFG is a representation of all paths that might be traversed through a program during its execution.

### What is CFG?

A Control Flow Graph (CFG) is a graphical representation of the flow of control in a program. It shows:

- All possible execution paths in a function
- Basic blocks of code (sequences of instructions with no branches except at the end)
- Branching points (if statements, loops, etc.)
- Function entry and exit points

### How to Generate CFG?

To generate a CFG for a specific function, use the follow command:

```bash
tlin -cfg -func <function_name> <path>
```

Where:

- `<function_name>` is the name of the function you want to analyze
- `<file_or_directory_path>` is the path to the file or directory containing the function

When you run this command, it outputs a string in DOT format. However, exporting to a file after rendering is not yet supported.

## Contributing

We welcome all forms of contributions, including bug reports, feature requests, and pull requests. Please feel free to open an issue or submit a pull request.
Expand Down

0 comments on commit 5b59bf3

Please sign in to comment.