TypeIdentifier: Preserve container types

Pass-through-types represent classes to be turned into containers. We
don't want these to turn these containers into Dummy's on a second run
of TypeIdentifier.
This commit is contained in:
Alastair Robertson 2023-07-06 06:10:57 -07:00 committed by Alastair Robertson
parent 9c45e0f22a
commit 8cb082372e
2 changed files with 5 additions and 2 deletions

View File

@ -61,7 +61,8 @@ void TypeIdentifier::visit(Container& c) {
for (size_t i = 0; i < c.templateParams.size(); i++) {
const auto& param = c.templateParams[i];
if (dynamic_cast<Dummy*>(param.type()) ||
dynamic_cast<DummyAllocator*>(param.type())) {
dynamic_cast<DummyAllocator*>(param.type()) ||
dynamic_cast<Container*>(param.type())) {
// In case the TypeIdentifier pass is run multiple times, we don't want to
// replace dummies again as the context of the original replacement has
// been lost.

View File

@ -177,7 +177,9 @@ TEST(TypeIdentifierTest, ContainerNotReplaced) {
Param
Primitive: int32_t
Param
Dummy (size: 0, align: 8)
[1] Container: std::allocator (size: 1)
Param
Primitive: int32_t
)");
}