db289c1a1a
CodeGen v2 permits template parameters to be qualified. This means that if we call `make_field` with a template parameter it will be qualified. However, we don't qualify the types when generating meta functions such as `NameProvider` and `TypeHandler`. This means these qualified types don't match up with the expected type. Use `std::decay_t` when forwarding the type to `NameProvider` and `TypeHandler` so they're always the base type that they were generated with. Most of this is covered by `make_field`, but there are direct references to `TypeHandler<Ctx, T>` in a lot of `TypeHandler::type` fields. Fix the problematic types manually for now, there may need to be a better solution with meta functions for this in the future. Test Plan: - CI - Added a test for `std::unique_ptr<const uint64_t>` to exercise this. Failed before, passes after. - Added a test for `std::unique_ptr<const std::vector<uint64_t>>` to test a non-primitive type. Failed before, passes after. |
||
---|---|---|
.. | ||
array_type.toml | ||
boost_bimap_type.toml | ||
caffe2_blob_type.toml | ||
cxx11_list_type.toml | ||
cxx11_string_type.toml | ||
deque_list_type.toml | ||
f14_fast_map.toml | ||
f14_fast_set.toml | ||
f14_node_map.toml | ||
f14_node_set.toml | ||
f14_value_map.toml | ||
f14_value_set.toml | ||
f14_vector_map.toml | ||
f14_vector_set.toml | ||
fb_string_type.toml | ||
folly_iobuf_queue_type.toml | ||
folly_iobuf_type.toml | ||
folly_optional_type.toml | ||
folly_small_heap_vector_map.toml | ||
list_type.toml | ||
map_seq_type.toml | ||
multi_map_type.toml | ||
multi_set_type.toml | ||
optional_type.toml | ||
pair_type.toml | ||
priority_queue_container_adapter_type.toml | ||
queue_container_adapter_type.toml | ||
README.md | ||
ref_wrapper_type.toml | ||
repeated_field_type.toml | ||
repeated_ptr_field_type.toml | ||
seq_type.toml | ||
set_type.toml | ||
shrd_ptr_type.toml | ||
small_vec_type.toml | ||
sorted_vec_set_type.toml | ||
stack_container_adapter_type.toml | ||
std_map_type.toml | ||
std_unordered_map_type.toml | ||
std_unordered_multimap_type.toml | ||
std_variant.toml | ||
string_type.toml | ||
thrift_isset_type.toml | ||
try_type.toml | ||
uniq_ptr_type.toml | ||
unordered_multiset_type.toml | ||
unordered_set_type.toml | ||
weak_ptr_type.toml |
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.
-
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.
-
required_features
A set of feature names such as
tree-builder-v2
which must be enabled for this container description to be included. Currently only supported with CodeGen v2 as that's their only use case and an implementation for CodeGen v1 would be untested.
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. -
processor.type
The static type that will be filled in by this particular processor. Multiple processors are allowed and recommended.
-
processor.func
C++ code for the function body of a function with this signature:
void(result::Element& el, std::stack<Inst>& ins, ParsedData d)
which is supplied with the data of the paired static type. -
traversal_func
C++ code for the function body of a function with this signature:
static types::st::Unit<DB> getSizeType(const T& container, ST returnArg)
whereST
defines the combined static type of each supplied processor. -
extra
Any extra C++ code to be included directly. This code is not automatically wrapped in a namespace, so definitions from different container TOML files will collide if they share the same name.
## Changes introduced with TreeBuilder V2
decl
andfunc
fields are ignored when using-ftree-builder-v2
. TheTypeHandler
is constructed fromtraversal_func
field andprocessor
entries.
Changes introduced with TypeGraph
typeName
andmatcher
fields have been merged into the single fieldtype_name
.ns
namespace definition is no longer required.underlyingContainerIndex
renamed tounderlying_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
-
ctype
A reference to the enum
ContainerTypeEnum
in OI's source code. This is no longer required with Tree Builder v2. -
handler
C++ code for the definition of a
TypeHandler
class for this container. Now generated fromtraversal_func
andprocessor
entries. -
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.