@@ -117,7 +117,7 @@ ConstraintSystem::ConstraintSystem(DeclContext *dc,
117
117
: Context(dc->getASTContext ()), DC(dc), Options(options),
118
118
diagnosticTransaction(diagnosticTransaction),
119
119
Arena(dc->getASTContext (), Allocator),
120
- CG(*new ConstraintGraph(* this ) )
120
+ CG(*this )
121
121
{
122
122
assert (DC && " context required" );
123
123
// Respect the global debugging flag, but turn off debugging while
@@ -130,9 +130,7 @@ ConstraintSystem::ConstraintSystem(DeclContext *dc,
130
130
Options |= ConstraintSystemFlags::UseClangFunctionTypes;
131
131
}
132
132
133
- ConstraintSystem::~ConstraintSystem () {
134
- delete &CG;
135
- }
133
+ ConstraintSystem::~ConstraintSystem () {}
136
134
137
135
void ConstraintSystem::startExpressionTimer (ExpressionTimer::AnchorType anchor) {
138
136
ASSERT (!Timer);
@@ -1102,7 +1100,7 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor(
1102
1100
if (getRepresentative (typeVar) != typeVar)
1103
1101
return nullptr ;
1104
1102
1105
- auto &CG = getConstraintGraph ();
1103
+ auto &CG = const_cast <ConstraintSystem *>( this )-> getConstraintGraph ();
1106
1104
auto &result = CG[typeVar];
1107
1105
auto equivalence = result.getEquivalenceClass ();
1108
1106
auto member = llvm::find_if (equivalence, [=](TypeVariableType *eq) {
0 commit comments