Comments (2)
Hello @rajendrasp,
thanks for raising this question.
Addressing the vtable:
What you're asking for isn't represented in the AST at the front-end stage. This is the main reason C++ Insights currently doesn't show that information. I have some idea of how to implement support for this, but it would be limited to the Itanium ABI, which is different from Microsoft and others.
Since you raised the question, how would you like to see the transformation?
Regarding the memory layout:
I'm not sure what you're missing here. There is an option to show padding information, giving you memory layout information.
Andreas
from cppinsights.
For vtable, I was thinking of seeing the memory layout of compiled object. Microsoft Visual C++ has following undocumented options that give layout information.
/d1reportSingleClassLayoutXXX
/d1reportAllClassLayout
https://stackoverflow.com/questions/2138890/layout-of-compiled-objects
Following is what it ouputs for a multiply-inherited classes.
Library.cpp
class IHen size(8):
+---
0 | +--- (base class IObject)
0 | | {vfptr}
| +---
+---
IHen::$vftable@:
| &IHen_meta
| 0
0 | &IObject::AddRef
1 | &IObject::Release
2 | &IObject::As
3 | &IHen::Cluck
4 | &IHen::Roost
IHen::Cluck this adjustor: 0
IHen::Roost this adjustor: 0
class IHen2 size(8):
+---
0 | +--- (base class IHen)
0 | | +--- (base class IObject)
0 | | | {vfptr}
| | +---
| +---
+---
IHen2::$vftable@:
| &IHen2_meta
| 0
0 | &IObject::AddRef
1 | &IObject::Release
2 | &IObject::As
3 | &IHen::Cluck
4 | &IHen::Roost
5 | &IHen2::Forage
IHen2::Forage this adjustor: 0
class Hen size(24):
+---
0 | +--- (base class IHen2)
0 | | +--- (base class IHen)
0 | | | +--- (base class IObject)
0 | | | | {vfptr}
| | | +---
| | +---
| +---
8 | +--- (base class IOfflineChicken)
8 | | +--- (base class IObject)
8 | | | {vfptr}
| | +---
| +---
16 | m_count
| (size=4)
+---
Hen::$vftable@IHen2@:
| &Hen_meta
| 0
0 | &Hen::AddRef
1 | &Hen::Release
2 | &Hen::As
3 | &Hen::Cluck
4 | &Hen::Roost
5 | &Hen::Forage
Hen::$vftable@IOfflineChicken@:
| -8
0 | &thunk: this-=8; goto Hen::AddRef
1 | &thunk: this-=8; goto Hen::Release
2 | &thunk: this-=8; goto Hen::As
3 | &Hen::Load
4 | &Hen::Save
I do not understand why thunk is used instead of just saying &Hen::AddRef in vtable "Hen::$vftable@IOfflineChicken@:".
But this is something I was hoping for with a bit of better presentation in the cppinsights.
I was also looking for code that initialises the this->_vptr in constructors. And compiler generated code in destructor if there is any.
Thanks.
from cppinsights.
Related Issues (20)
- Missing Clang 16 support HOT 1
- CppInsights crash with stack dump HOT 2
- Non-`constexpr` destructor removes `constexpr`-ness for defaulted assignment operators HOT 2
- for-loops as while-loops is wrong for ranged-based for loop HOT 2
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- for-loops as while-loops is wrong for ranged-based for loop HOT 1
- Can I use #include <Windows.h> with cppinsights? HOT 4
- coroutine transformation: Support _promise-constructor-arguments_ HOT 5
- [BUG] with getting a global variable HOT 1
- Generated insight for `jmp_buf` global variable declarations. HOT 1
- invoke lambda with `temp.operator()()` generate wrong code. HOT 1
- Error building inside clang source tree HOT 1
- About nested class inside a class template HOT 1
- Specialization of variable templates misses type deduction and `template` HOT 1
- Would it possible to have more educational things supported? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppinsights.