2022-12-19 14:37:51 +00:00
|
|
|
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 for vector
|
|
|
|
struct Foo {
|
|
|
|
std::vector<nsA::C, CustomAllocator<nsA::C>> v1;
|
|
|
|
std::vector<nsB::C, CustomAllocator<nsB::C>> v2;
|
|
|
|
};
|
|
|
|
|
|
|
|
'''
|
|
|
|
includes = ["vector"]
|
|
|
|
|
|
|
|
[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":[
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
2022-12-19 14:37:51 +00:00
|
|
|
"members":[
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"a", "staticSize":4, "dynamicSize":0}
|
2022-12-19 14:37:51 +00:00
|
|
|
]}
|
|
|
|
]},
|
|
|
|
{"name":"v2", "staticSize":24, "dynamicSize":8, "length":2, "capacity":2, "elementStaticSize":4,
|
|
|
|
"members":[
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
2022-12-19 14:37:51 +00:00
|
|
|
"members":[
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"b", "staticSize":4, "dynamicSize":0}
|
2022-12-19 14:37:51 +00:00
|
|
|
]},
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"", "staticSize":4, "dynamicSize":0,
|
2022-12-19 14:37:51 +00:00
|
|
|
"members":[
|
2023-12-13 16:49:41 +00:00
|
|
|
{"name":"b", "staticSize":4, "dynamicSize":0}
|
2022-12-19 14:37:51 +00:00
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]}]'''
|
2023-08-16 20:40:36 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"staticSize":48,
|
|
|
|
"exclusiveSize":0,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size":60,
|
2023-08-16 20:40:36 +01:00
|
|
|
"members":[
|
2024-01-03 17:30:31 +00:00
|
|
|
{"name":"v1", "staticSize":24, "exclusiveSize":24, "size": 28, "length":1, "capacity":1, "members":[
|
|
|
|
{"name":"[]", "staticSize":4, "exclusiveSize":0, "size": 4, "members":[
|
|
|
|
{"name":"a", "staticSize":4, "exclusiveSize":4, "size": 4, "members":[]}
|
2023-08-16 20:40:36 +01:00
|
|
|
]}
|
|
|
|
]},
|
2024-01-03 17:30:31 +00:00
|
|
|
{"name":"v2", "staticSize":24, "exclusiveSize":24, "size": 32, "length":2, "capacity":2, "members":[
|
|
|
|
{"name":"[]", "staticSize":4, "exclusiveSize":0, "size": 4, "members":[
|
|
|
|
{"name":"b", "staticSize":4, "exclusiveSize":4, "size": 4, "members":[]}
|
2023-08-16 20:40:36 +01:00
|
|
|
]},
|
2024-01-03 17:30:31 +00:00
|
|
|
{"name":"[]", "staticSize":4, "exclusiveSize":0, "size": 4, "members":[
|
|
|
|
{"name":"b", "staticSize":4, "exclusiveSize":4, "size": 4, "members":[]}
|
2023-08-16 20:40:36 +01:00
|
|
|
]}
|
|
|
|
]}
|
|
|
|
]
|
|
|
|
}]'''
|