includes = ["functional", "memory"] definitions = ''' struct RawNode { int value; struct RawNode* next; }; struct UniqueNode { int value; std::unique_ptr next; }; struct SharedNode { int value; std::shared_ptr next; }; ''' [cases] [cases.raw_ptr] oil_disable = "oil can't chase pointers safely" param_types = ["RawNode*"] setup = ''' RawNode *first = new RawNode{1, nullptr}; RawNode *second = new RawNode{2, nullptr}; RawNode *third = new RawNode{3, nullptr}; first->next = second; second->next = third; third->next = first; return first; ''' cli_options = ["--chase-raw-pointers"] expect_json = ''' [ { "typeName": "RawNode", "staticSize": 16, "dynamicSize": 32, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "struct RawNode *", "staticSize": 8, "dynamicSize": 32, "members": [ { "typeName": "RawNode", "staticSize": 16, "dynamicSize": 16, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "struct RawNode *", "staticSize": 8, "dynamicSize": 16, "members": [ { "typeName": "RawNode", "staticSize": 16, "dynamicSize": 0, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "struct RawNode *", "staticSize": 8, "dynamicSize": 0 } ] } ] } ] } ] } ] } ] ''' [cases.unique_ptr] param_types = ["std::reference_wrapper&"] setup = ''' auto first = std::make_unique(); auto firstPtr = first.get(); first->next = std::make_unique(); first->next->next = std::make_unique(); first->next->next->next = std::move(first); return *firstPtr; ''' expect_json = ''' [ { "typeName": "reference_wrapper", "staticSize": 8, "dynamicSize": 48, "members": [ { "typeName": "UniqueNode", "staticSize": 16, "dynamicSize": 32, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "unique_ptr >", "staticSize": 8, "dynamicSize": 32, "members": [ { "typeName": "UniqueNode", "staticSize": 16, "dynamicSize": 16, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "unique_ptr >", "staticSize": 8, "dynamicSize": 16, "members": [ { "typeName": "UniqueNode", "staticSize": 16, "dynamicSize": 0, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "unique_ptr >", "staticSize": 8, "dynamicSize": 0 } ] } ] } ] } ] } ] } ] } ] ''' [cases.shared_ptr] param_types = ["std::reference_wrapper&"] setup = ''' auto first = std::make_shared(); auto firstPtr = first.get(); first->next = std::make_shared(); first->next->next = std::make_shared(); first->next->next->next = first; return *firstPtr; ''' expect_json = ''' [ { "typeName": "reference_wrapper", "staticSize": 8, "dynamicSize": 72, "members": [ { "typeName": "SharedNode", "staticSize": 24, "dynamicSize": 48, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "shared_ptr", "staticSize": 16, "dynamicSize": 48, "members": [ { "typeName": "SharedNode", "staticSize": 24, "dynamicSize": 24, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "shared_ptr", "staticSize": 16, "dynamicSize": 24, "members": [ { "typeName": "SharedNode", "staticSize": 24, "dynamicSize": 0, "members": [ { "typeName": "int", "staticSize": 4, "dynamicSize": 0 }, { "typeName": "shared_ptr", "staticSize": 16, "dynamicSize": 0 } ] } ] } ] } ] } ] } ] } ] '''