Interactive diagram generator from C++ code. Combine human intelligence to select only relevant elements for a diagram with machine to perform call tree analysis in correct and repetitive manner.
If you're using a stretch container, you have to add the repository for the right libclang version first:
sudo apt install -y software-properties-common
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-6.0 main"
sudo apt update
sudo apt install -y python3-setuptools python3-pip python3-pyqt5 libclang-6.0-dev
cd ~/workspace
git clone https://github.com/rknuus/INCode.git
cd INCode
sudo python3 setup.py install
sudo python3 setup.py build
build/scripts-3.5/INCode
cd ~/workspace
git clone https://github.com/rknuus/INCode.git
cd INCode
sudo python3 setup.py develop
LD_LIBRARY_PATH=/usr/lib/llvm-6.0/lib python3 setup.py test
Start INCode: LD_LIBRARY_PATH=/usr/lib/llvm-6.0/lib python3 INCode/bin/INCode
The first window that will popup is the entry dialog. The purpose of this window is to select your starting point.
Optionally set extra compiler arguments. For reasons I don't understand, yet, the compilation database (json) might not contain the complete set of compiler arguments, particularly the internal include directories might be missing. To figure out necessary extra arguments I had to make ninja
print compiler calls and add -v
to the C++ compiler options.
At first, you have to select the compilation database (json) of the c++ code you want to analyze.
Afterwards, all cpp files from the project should show up. From this list you can choose your wanted entry file.
Once that is done, you should be able to see all callables from the entry file, from where you can select entry point and click OK
.
The diagram configuration window shows up right after the selection of the entry point and is the main window of this application.
Your entry point is the root of the tree view. From there you can start to reveal the child callables from the functions.
All children in the same translation unit as the root node are already loaded. To load definitions of callables in other translation units you can either go to Actions -> Reveal Children
or just use the shortcut Ctrl + R
.
Every node has a checkbox that you have to check for every callable that you'd like to include into the diagram (shortcut: Space
).
With the Option Show Preview
(shortcut: Ctrl + T
) on the Actions tab you can enable and disable a preview of the current state of the diagram.
As soon as you have every wanted callable checked, you can export the diagram using Actions -> Export
(shortcut Ctrl + S
).
After the export function of the diagram configuration window you should see the export output in the console.
Finally you can convert the exported file to a PNG image with the following command: plantuml <file>
.
After that the UML diagram should be generated as <file>.png
.