includes = ["memory", "cstdint"] definitions = ''' void void_int_deleter(void *void_ptr) { auto *int_ptr = static_cast(void_ptr); delete int_ptr; } ''' [cases] [cases.unique_ptr_uint64_empty] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr&"] setup = "return {nullptr};" expect_json = ''' [ { "staticSize": 8, "dynamicSize": 0, "exclusiveSize": 8, "length": 0, "capacity": 1, "elementStaticSize": 8 } ] ''' [cases.unique_ptr_uint64_present] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr&"] setup = "return {std::make_unique(64)};" expect_json = ''' [ { "staticSize": 8, "dynamicSize": 8, "length": 1, "capacity": 1, "elementStaticSize": 8 } ] ''' [cases.unique_ptr_vector_empty] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr>&"] setup = "return {nullptr};" expect_json = ''' [ { "staticSize": 8, "dynamicSize": 0, "length": 0, "capacity": 1, "elementStaticSize": 24 } ] ''' [cases.unique_ptr_vector_present] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr>&"] setup = "return {std::make_unique>(std::initializer_list({1,2,3,4,5}))};" expect_json = ''' [ { "staticSize": 8, "dynamicSize": 64, "exclusiveSize": 8, "length": 1, "capacity": 1, "elementStaticSize": 24, "members": [ { "staticSize": 24, "dynamicSize": 40, "exclusiveSize": 64 } ] } ] ''' [cases.unique_ptr_void_empty] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr&"] setup = "return {std::unique_ptr(nullptr, &void_int_deleter)};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0 } ] ''' [cases.unique_ptr_void_present] oil_skip = "std::unique_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/299 param_types = ["std::unique_ptr&"] setup = "return {std::unique_ptr(new int, &void_int_deleter)};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0 } ] ''' [cases.shared_ptr_uint64_empty] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr&"] setup = "return {nullptr};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0, "length": 0, "capacity": 1, "elementStaticSize": 8 } ] ''' [cases.shared_ptr_uint64_present] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr&"] setup = "return std::make_shared(64);" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 8, "length": 1, "capacity": 1, "elementStaticSize": 8 } ] ''' [cases.shared_ptr_vector_empty] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr>&"] setup = "return {nullptr};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0, "length": 0, "capacity": 1, "elementStaticSize": 24 } ] ''' [cases.shared_ptr_vector_present] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr>&"] setup = "return std::make_shared>(std::initializer_list({1,2,3,4,5}));" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 64, "length": 1, "capacity": 1, "elementStaticSize": 24, "members": [ { "staticSize": 24, "dynamicSize": 40 } ] } ] ''' [cases.shared_ptr_void_empty] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr&"] setup = "return {nullptr};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0, "exclusiveSize": 16 } ] ''' [cases.shared_ptr_void_present] oil_skip = "std::shared_ptr is not implemented for treebuilder v2" # https://github.com/facebookexperimental/object-introspection/issues/300 param_types = ["std::shared_ptr&"] setup = "return {std::shared_ptr(new int)};" expect_json = ''' [ { "staticSize": 16, "dynamicSize": 0, "exclusiveSize": 16 } ] ''' [cases.weak_ptr_int64_empty] param_types = ["std::weak_ptr&"] setup = "return std::weak_ptr();" expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]''' [cases.weak_ptr_int64_void_empty] param_types = ["std::weak_ptr&"] setup = "return std::weak_ptr();" expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]''' [cases.weak_ptr_int64_present] param_types = ["std::weak_ptr&"] setup = ''' static std::shared_ptr shd = std::make_shared(0xDEADBEEF); std::weak_ptr weak = shd; return weak; ''' expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]''' [cases.weak_ptr_int64_expired] param_types = ["std::weak_ptr&"] setup = ''' std::shared_ptr shd = std::make_shared(0xDEADBEEF); std::weak_ptr weak = shd; return weak; ''' expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]''' [cases.weak_ptr_int64_present_chase] param_types = ["std::weak_ptr&"] cli_options = ["-fchase-raw-pointers"] setup = ''' static std::shared_ptr shd = std::make_shared(0xDEADBEEF); std::weak_ptr weak = shd; return weak; ''' expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]''' [cases.weak_ptr_int64_expired_chase] param_types = ["std::weak_ptr&"] cli_options = ["-fchase-raw-pointers"] setup = ''' return std::make_shared(0xDEADBEEF); ''' expect_json = ''' [ { "staticSize": 16, "exclusiveSize": 16, "dynamicSize": 0, "NOT": "members" } ] ''' expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "members":[]}]'''