Is there a way (g++ option?) to check what code is generated implicitly by the C++ compiler (e.g. all the default constructors/destructors)?
Having the generated C++ code would be ideal, but at least the assembly would be good. Using:
g++ -S -g -O0 <file.cpp>
does not give me any label with generated constructors/destructors.
I think option the -fdump-tree-original
is about as close as you can get. Unfortunately it'll show both your own code and automatically generated code, but it won't label which is which. However it's the most readable of GCC's dumps and it shows the generated code before any optimizations are performed.
Another option would be to use -fdump-translation-unit
. That creates a raw dump of the tree with literally everything in it. The nodes that compiler made up will be marked as "artificial". However, the format isn't easy for humans to read and there's a lot of it wade through even for a trivial source file. To get any useful information out of it you'd probably need to write a program to read it in and then walk the tree to find the nodes you're interested in and print them out it a more readable format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With