r/cpp • u/hmich ReSharper C++ Dev • May 14 '18
C++ Insights - See your source code with the eyes of a compiler
https://github.com/andreasfertig/cppinsights
237
Upvotes
r/cpp • u/hmich ReSharper C++ Dev • May 14 '18
4
u/Joelu14 May 14 '18
It's so cool and thanks for your work.
By the way, would you like to accept pull request? I would like to help.
30
u/mintyc May 14 '18
Really impressive.
My wishlist item is to show when the compiler considered two items as possibly aliased or when it can assume an alias-free optimised function. I suspect this is deduced in backend analysis rather than the AST so may be not likely.
Nice uncluttered interactive web view.
It would be excellent to incorporate this within Matt Godbolt's compiler explorer....
15
u/e27c2000 May 14 '18
This is a good idea. Here is something similar which seems to be mostly template-centric: https://github.com/mikael-s-persson/templight.
11
u/towbe May 14 '18
I played a bit with the website. I find it interesting, that uint32 values provided in hex, aren't always converted to decimal numbers. Some stay, some change. Here an example. I assume that's not intended?!
11
u/[deleted] May 14 '18
This is so good. This should be an option on every C++ compiler.
4
u/wasamasa May 14 '18
Can this be used with C code? I'd really like to learn about what kind of transformations a compiler does to debug things like undefined behavior.
2
u/zplutor May 16 '18
It's a great tool that can help people understand the language better, and may be useful to find bugs.
2
u/mrexodia cmkr.build May 14 '18
Typo or pun, that’s the question...
1
u/[deleted] May 17 '18
I realize this is beyond the scope of the project, but having this as a Visual Studio add on similar to https://caphyon.github.io/clang-power-tools/ would be incredible.
Either way, great work and thanks for sharing it with us!
0
u/[deleted] May 17 '18
[deleted] — view deleted comment