File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
include/swift/SILOptimizer/PassManager
lib/SILOptimizer/PassManager Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,8 @@ class SwiftPassInvocation {
102
102
SwiftPassInvocation (SILPassManager *passManager) :
103
103
passManager (passManager) {}
104
104
105
+ ~SwiftPassInvocation ();
106
+
105
107
SILPassManager *getPassManager () const { return passManager; }
106
108
107
109
SILTransform *getTransform () const { return transform; }
Original file line number Diff line number Diff line change @@ -1392,9 +1392,7 @@ irgen::IRGenModule *SwiftPassInvocation::getIRGenModule() {
1392
1392
1393
1393
irgen = new irgen::IRGenerator (*irgenOpts, *module );
1394
1394
auto targetMachine = irgen->createTargetMachine ();
1395
- if (!targetMachine)
1396
- return nullptr ;
1397
-
1395
+ assert (targetMachine && " failed to create target" );
1398
1396
irgenModule = new irgen::IRGenModule (*irgen, std::move (targetMachine));
1399
1397
}
1400
1398
return irgenModule;
@@ -1410,14 +1408,6 @@ void SwiftPassInvocation::endPass() {
1410
1408
delete ssaUpdater;
1411
1409
ssaUpdater = nullptr ;
1412
1410
}
1413
- if (irgenModule) {
1414
- delete irgenModule;
1415
- irgenModule = nullptr ;
1416
- }
1417
- if (irgen) {
1418
- delete irgen;
1419
- irgen = nullptr ;
1420
- }
1421
1411
}
1422
1412
1423
1413
void SwiftPassInvocation::beginTransformFunction (SILFunction *function) {
@@ -1438,6 +1428,17 @@ void SwiftPassInvocation::endTransformFunction() {
1438
1428
assert (numNodeSetsAllocated == 0 && " Not all NodeSets deallocated" );
1439
1429
}
1440
1430
1431
+ SwiftPassInvocation::~SwiftPassInvocation () {
1432
+ if (irgenModule) {
1433
+ delete irgenModule;
1434
+ irgenModule = nullptr ;
1435
+ }
1436
+ if (irgen) {
1437
+ delete irgen;
1438
+ irgen = nullptr ;
1439
+ }
1440
+ }
1441
+
1441
1442
// ===----------------------------------------------------------------------===//
1442
1443
// Swift Bridging
1443
1444
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments