Skip to content

Commit e7d7c18

Browse files
committed
TypeIdentifier: Preserve container types
Pass-through-types turn classes into containers. We don't want these to turn into Dummy's on a second run of TypeIdentifier.
1 parent 51134e8 commit e7d7c18

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

oi/type_graph/TypeIdentifier.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ void TypeIdentifier::visit(Container& c) {
6161
for (size_t i = 0; i < c.templateParams.size(); i++) {
6262
const auto& param = c.templateParams[i];
6363
if (dynamic_cast<Dummy*>(param.type()) ||
64-
dynamic_cast<DummyAllocator*>(param.type())) {
64+
dynamic_cast<DummyAllocator*>(param.type()) ||
65+
dynamic_cast<Container*>(param.type())) {
6566
// In case the TypeIdentifier pass is run multiple times, we don't want to
6667
// replace dummies again as the context of the original replacement has
6768
// been lost.

test/test_type_identifier.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ TEST(TypeIdentifierTest, ContainerNotReplaced) {
177177
Param
178178
Primitive: int32_t
179179
Param
180-
Dummy (size: 0, align: 8)
180+
[1] Container: std::allocator (size: 1)
181+
Param
182+
Primitive: int32_t
181183
)");
182184
}
183185

0 commit comments

Comments
 (0)