C++ Insights is a tool based on clang that transforms your source code into the source code seen by the compiler.
The aim is to make things visible, which normally and intentionally happen behind the scenes. It’s about the magic the compiler does to make things work. Or looking through a compiler’s classes.
For example:
Suppose you have this code:
In fact this code looks like this by your compiler:
C++ Insights is available online, but if you want to build and install it on your system, there are some details. You will need the following construction tools:
Example in Ubuntu:
Then just clone and build with the following command:
If you can’t, try this:
Note that the linker and the compiler are informed via parameter to CMake, if you want to reinforce it, run the commands before
cmake
:export CXX=$(which clang++)
and for the linker:env LD=$ (which lld)
.
You can still try with
make
:cmake -G "Unix Makefiles" ..
plus the other parameters above.
I thought about compiling with these “closed loop” tools… Anyway, good luck compiling, you’ll need it!
If you managed to compile and install it, the use is very simple, for example to analyze a code:
If you were NOT able to compile and install, relax! You can use it online at:
I’m sure it’s a lot easier! 😃
For more information, also visit GitHub: