Commit Graph

14 Commits

Author SHA1 Message Date
Alastair Robertson
784b900218 TypeGraph: Replace allocators with DummyAllocator
When we were previously removing allocators, we were only able to work
with containers whose allocators appeared as their last template
parameter.

Now we can replace allocators in the middle of a parameter list.

This fixes tests for folly::sorted_vector_set.
2023-05-31 15:49:37 +01:00
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
Alastair Robertson
68290655b1 TypeGraph: Update container TOML files to new format
This change is fully backwards compatible with the old ContainerInfo
parser, as it is just adding new fields.

The old fields will continue to be used by legacy OICodeGen until that
is removed.

Also add a README to document the format.
2023-05-26 18:21:59 +01:00
Jake Hillion
cd2fa8c9ef remove treebuilder pointer validation 2023-04-18 16:04:47 +02:00
Jake Hillion
f47628ae2d add test for folly::fbstring 2023-04-06 15:11:09 +01:00
Jay Kamat
e27f725a85 Avoid following weak_ptrs
Previously, we treated weak_ptrs as normal types and we recursed
within them, following the internal data pointer and possibly causing
crashes. We really shouldn't be following them, so I added a custom
type to simply abort processing. If we want to handle them (ie: check
if they are valid, and follow them if so), that should be fairly easy
with the work there is here so far.
2023-03-28 14:10:27 -07:00
Jake Hillion
2e74fa357a std::variant: change to use std::visit 2023-03-24 18:43:37 +00:00
Jake Hillion
3a236aa4f2 sorted_vec_set: finish changing to a container adapter 2023-02-24 10:31:59 -08:00
Jon Haslam
e458ca99eb
Stop enumerating template params for sorted_vector_set (#74) 2023-02-21 11:24:02 -08:00
Jon Haslam
c260586a4e
Fix folly::sorted_vector_set and minor codegen comment change (#63) 2023-02-08 14:34:14 +00:00
Jay Kamat
01abff9019 Update small vec types to reflect folly update
Folly updated the signature of small vec types here:
c0a4e11b31

I needed to add a new 'using' for policy_size_type, as this is commonly
used with this new template parameter.
2023-01-30 19:01:38 -08:00
Jon Haslam
885c2ec369
Support std::multimap with comparator template parameter (#33)
Co-authored-by: Jon Haslam <jonhaslam@meta.com>
2023-01-20 16:30:02 +00:00
Jake Hillion
2dc5479c32 container regex matching 2022-12-21 14:31:05 +00:00
Jon Haslam
db90326c4b Initial commit 2022-12-19 06:37:51 -08:00