object-introspection/types
Alastair Robertson 3d91603c8e TypeGraph: Fix std::string container
std::basic_string takes three template parameters:
1. CharT
2. Traits
3. Allocator

The Traits parameter was causing issues, as it requires a type which
exposes certain things, e.g. `Traits::value_type`.

We have a few options to resolve this:
1. Remove this parameter, as we do for allocators
    Cons: removing a template parameter doesn't work if other
    parameters appear after it

2. Stub this parameter, as we do for hashers/comparators
    Cons: we need to hardcode an implementation that satisfies the
    `Traits::value_type` requirements

3. Leave the parameter as-is
    Cons: will not work if a non-standard Traits is used

    By using the real implementation of this Traits parameter
    (normally `std::char_traits<CharT>`), we get one that we know will
    work as long as it is defined in a stdlib header.

Option 3 is what we use in this patch. Instead of adding more
configuration options to the container TOML file format (e.g.
`params_to_keep = [1]`), we add `std::char_traits` as a dummy
container type. Now, whenever `std::char_traits` appears, it will be
left as-is, i.e. not removed, replaced or reverse-engineered.

This is the same approach previously used for Thrift's isset_bitset.
2023-05-30 17:17:29 +01:00
..
array_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
boost_bimap_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
caffe2_blob_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
cxx11_list_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
cxx11_string_type.toml TypeGraph: Fix std::string container 2023-05-30 17:17:29 +01:00
deque_list_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_fast_map.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_fast_set.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_node_map.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_node_set.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_vector_map.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
f14_vector_set.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
fb_string_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
folly_iobuf_queue_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
folly_iobuf_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
folly_optional_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
folly_small_heap_vector_map.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
list_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
map_seq_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
multi_map_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
optional_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
pair_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
priority_queue_container_adapter_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
queue_container_adapter_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
README.md TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
ref_wrapper_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
repeated_field_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
repeated_ptr_field_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
seq_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
set_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
shrd_ptr_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
small_vec_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
sorted_vec_set_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
stack_container_adapter_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
std_char_traits.toml TypeGraph: Fix std::string container 2023-05-30 17:17:29 +01:00
std_map_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
std_unordered_map_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
std_variant.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
string_type.toml TypeGraph: Fix std::string container 2023-05-30 17:17:29 +01:00
thrift_isset_type.toml TypeGraph: Fix std::string container 2023-05-30 17:17:29 +01:00
try_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
uniq_ptr_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
unordered_set_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00
weak_ptr_type.toml TypeGraph: Update container TOML files to new format 2023-05-26 18:21:59 +01:00

Container Type Definition Format

This document describes the format of the container definition files contained in this directory.

info

  • type_name

    The fully-qualified name of the container type. This is used to match against the names of types contained in an executable's debug information.

  • ctype

    A reference to the enum ContainerTypeEnum in OI's source code.

  • header

    The name of the C++ header file in which this container is defined.

  • stub_template_params

    The indexes of template parameters which do not represent types stored within this container. These parameters will not be recursed into and measured by OI.

  • underlying_container_index

    Only used for container adapters. Points OI to the template parameter representing the underlying container to be measured.

codegen

  • decl

    C++ code for the declaration of a getSizeType function for this container.

  • func

    C++ code for the definition of a getSizeType function for this container.

Changes introduced with TypeGraph

  • typeName and matcher fields have been merged into the single field type_name.
  • ns namespace definition is no longer required.
  • underlyingContainerIndex renamed to underlying_container_index
  • The options for measuring / stubbing / removing template parameters have been reworked:
    • By default all parameters are now measured. This includes the tail parameters in a variadic template.
    • There is one option to specify template parameters which should not be measured: stub_template_params. The type graph code will automatically determine what type of stubbing to apply to each parameter in this list.

Deprecated Options

  • numTemplateParams

    The first numTemplateParams template parameters for this container represent the types for the data we want to process. If this is not set, use all a container's template parameters. All of a container's parameters will still be enumerated and output in CodeGen, regardless of this setting.

  • allocatorIndex

    Index of a template parameter representing an allocator. It will be not be used when CodeGenning this container.

  • replaceTemplateParamIndex

    Indexes of template parameters to be stubbed out, i.e. replaced with dummy structs of a given size. Used for custom hashers and comparers.