Automatically generate flowcharts out of C++ code

2020-07-11 04:25发布

I need to automatically construct flowcharts out of C++ code, ideally one flowchart per source file. Is there any tool (preferably C++/Python and either open-sourced or highly configurable - so I may change the look) that I can use to create flowcharts?

http://www.faqs.org/patents/img/20110088010_08.png

3条回答
该账号已被封号
2楼-- · 2020-07-11 05:10

If you don't mind plaintext output, 'cflow' will do the job. It's in the repositories of at least Debian, and probably most Linux distro's.

查看更多
Animai°情兽
3楼-- · 2020-07-11 05:14

clang/llvm can generate graphviz dot files.

Example:

clang -S -emit-llvm -o hello.ll hello.cpp
opt hello.ll -dot-cfg -o hello.dot

This will output several .dot files, one for each function defined in hello.cpp. You can also generate dominance graph, post dominance graph and more (see here).

After you have your .dotfiles you can use dot to convert it to a .png file. The .dot file itself contains only the structure of the graph, so the output of dot should be highly configurable (but I am not really familiar with it).

查看更多
The star\"
4楼-- · 2020-07-11 05:23

Use Enterprise Architect tool.

http://www.sparxsystems.com/enterprise_architect_user_guide/9.2/execution_analyzer/generating_sequence_diagram.html

You can generate sequence diagram while you debug the code.

Demonstration: Online Demo

Note:- This works with C++ code as well. Just use Native debugger.

查看更多
登录 后发表回答