Summary:
Previously on large types OIL would have problems with corrupting the `std::stack<exporter::inst::Inst>` that is passed to the processors. This change hides the implementation of the stack from the processors by wrapping the call to emplace in a `std::function` written by the non-generated code, which solves the test case I've seen for this crashing. It also allows us to easily change the stack implementation in future - I plan to change it to a `std::stack<T, std::vector<T>>` in a follow up.
Reviewed By: tyroguru
Differential Revision: D49273116
Types within containers were previously named TODO. This sorts it out so
they're named as their most resolved type. The current implementation
skips Typedef names.
These represent types which don't store any interesting data for us to
measure, but which are required by a real container so can not be
replaced with our own generated class types.
std::allocator often has bad DWARF, so it must be replaced after the
DWARF is fixed up in Flattener. The others could be replaced earlier in
the transformation process if desired, but I've left them all together
for simplicity for now.
This fixes the folly::fbstring tests.
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.
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.
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.