Invalidate ConstantManager if TypeManager is invalidated... (#2302)
...as the ConstantManager contains pointers into the TypeManager.
diff --git a/source/opt/ir_context.cpp b/source/opt/ir_context.cpp
index fe69027..a31349f 100644
--- a/source/opt/ir_context.cpp
+++ b/source/opt/ir_context.cpp
@@ -127,6 +127,9 @@
constant_mgr_.reset(nullptr);
}
if (analyses_to_invalidate & kAnalysisTypes) {
+ // The ConstantManager contains Type pointers. If the TypeManager goes
+ // away, the ConstantManager has to go away.
+ constant_mgr_.reset(nullptr);
type_mgr_.reset(nullptr);
}