Skip to content

Commit 36a15ce

Browse files
authored
[sil] Fix the no-assert build by not calling an ifndef NDEBUG method (part 2) (#69716)
PR #69652 protected one call of `printID` but left another two in the file. Create two small lambdas to print the ID with `printID` or just print `NOASSERTS` depending on `NDEBUG` being defined. Change all the callsites of `printID` to use that lambda.
1 parent 17c30f1 commit 36a15ce

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/SILOptimizer/Mandatory/TransferNonSendable.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -1436,10 +1436,15 @@ class BlockPartitionState {
14361436
os << SEP_STR << "BlockPartitionState[reached=" << reached
14371437
<< ", needsUpdate=" << needsUpdate << "]\nid: ";
14381438
#ifndef NDEBUG
1439-
basicBlock->printID(os);
1439+
auto printID = [&](SILBasicBlock *block) {
1440+
block->printID(os);
1441+
};
14401442
#else
1441-
os << "NOASSERTS. ";
1443+
auto printID = [&](SILBasicBlock *) {
1444+
os << "NOASSERTS. ";
1445+
};
14421446
#endif
1447+
printID(basicBlock);
14431448
os << "entry partition: ";
14441449
entryPartition.print(os);
14451450
os << "exit partition: ";
@@ -1452,12 +1457,12 @@ class BlockPartitionState {
14521457
os << "└──────────╼\nSuccs:\n";
14531458
for (auto succ : basicBlock->getSuccessorBlocks()) {
14541459
os << "";
1455-
succ->printID(os);
1460+
printID(succ);
14561461
}
14571462
os << "Preds:\n";
14581463
for (auto pred : basicBlock->getPredecessorBlocks()) {
14591464
os << "";
1460-
pred->printID(os);
1465+
printID(pred);
14611466
}
14621467
os << SEP_STR;
14631468
}

0 commit comments

Comments
 (0)