mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
08e2faa90e
`std::list` has per element overhead for the individual heap allocations. This was already calculated in the container implementation but not used. Allocate the overhead of each element in the `std::list` to the `std::list` itself as with other sequential containers. Test Plan: - CI - Updated test cases
68 lines
1.8 KiB
TOML
68 lines
1.8 KiB
TOML
definitions = '''
|
|
namespace nsA {
|
|
struct C {
|
|
int a;
|
|
};
|
|
}
|
|
namespace nsB {
|
|
struct C {
|
|
int b;
|
|
};
|
|
}
|
|
|
|
template<typename T>
|
|
class CustomAllocator: public std::allocator<T>
|
|
{
|
|
|
|
};
|
|
|
|
// Naming conflict will only work if OI deletes the allocator field
|
|
struct Foo {
|
|
std::list<nsA::C, CustomAllocator<nsA::C>> v1;
|
|
std::list<nsB::C, CustomAllocator<nsB::C>> v2;
|
|
};
|
|
|
|
'''
|
|
includes = ["list"]
|
|
|
|
[cases]
|
|
[cases.a]
|
|
param_types = ["const Foo&"]
|
|
setup = '''
|
|
Foo foo;
|
|
foo.v1.resize(1);
|
|
foo.v2.resize(2);
|
|
return {foo};
|
|
'''
|
|
expect_json = '''[{
|
|
"staticSize":48,
|
|
"dynamicSize":12,
|
|
"members":[
|
|
{"name":"v1", "staticSize":24, "dynamicSize":4, "length":1, "capacity":1, "elementStaticSize":4,
|
|
"members":[
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
|
"members":[
|
|
{"name":"a", "staticSize":4, "dynamicSize":0}
|
|
]}
|
|
]},
|
|
{"name":"v2", "staticSize":24, "dynamicSize":8, "length":2, "capacity":2, "elementStaticSize":4,
|
|
"members":[
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
|
"members":[
|
|
{"name":"b", "staticSize":4, "dynamicSize":0}
|
|
]},
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
|
"members":[
|
|
{"name":"b", "staticSize":4, "dynamicSize":0}
|
|
]}
|
|
]}
|
|
]}]'''
|
|
expect_json_v2 = '''[{
|
|
"staticSize": 48,
|
|
"exclusiveSize": 0,
|
|
"size": 120,
|
|
"members": [
|
|
{"name": "v1", "staticSize": 24, "exclusiveSize": 44, "size": 48, "length": 1, "capacity": 1},
|
|
{"name": "v2", "staticSize": 24, "exclusiveSize": 64, "size": 72, "length": 2, "capacity": 2}
|
|
]}]'''
|