@@ -117,7 +117,7 @@ ConstraintSystem::ConstraintSystem(DeclContext *dc,
117117 : Context(dc->getASTContext ()), DC(dc), Options(options),
118118 diagnosticTransaction(diagnosticTransaction),
119119 Arena(dc->getASTContext (), Allocator),
120- CG(*new ConstraintGraph(* this ) )
120+ CG(*this )
121121{
122122 assert (DC && " context required" );
123123 // Respect the global debugging flag, but turn off debugging while
@@ -130,9 +130,7 @@ ConstraintSystem::ConstraintSystem(DeclContext *dc,
130130 Options |= ConstraintSystemFlags::UseClangFunctionTypes;
131131}
132132
133- ConstraintSystem::~ConstraintSystem () {
134- delete &CG;
135- }
133+ ConstraintSystem::~ConstraintSystem () {}
136134
137135void ConstraintSystem::startExpressionTimer (ExpressionTimer::AnchorType anchor) {
138136 ASSERT (!Timer);
@@ -1102,7 +1100,7 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor(
11021100 if (getRepresentative (typeVar) != typeVar)
11031101 return nullptr ;
11041102
1105- auto &CG = getConstraintGraph ();
1103+ auto &CG = const_cast <ConstraintSystem *>( this )-> getConstraintGraph ();
11061104 auto &result = CG[typeVar];
11071105 auto equivalence = result.getEquivalenceClass ();
11081106 auto member = llvm::find_if (equivalence, [=](TypeVariableType *eq) {
0 commit comments