Skip to content

Commit 8105ac0

Browse files
committed
SIL: force the destructor of DeadEndBlocks to be placed in a C++ file
Otherwise it can happen that it is generated in a SwiftCompilerSources module and that results in unresolved-symbols linker errors.
1 parent 7f43e52 commit 8105ac0

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/swift/SIL/BasicBlockUtils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class DeadEndBlocks {
7373
public:
7474
DeadEndBlocks(const SILFunction *f) : f(f) {}
7575

76+
~DeadEndBlocks();
77+
7678
/// Returns true if \p BB is a dead-end block.
7779
bool isDeadEnd(const SILBasicBlock *block) {
7880
if (!didComputeValue) {

lib/SIL/Utils/BasicBlockUtils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ void swift::mergeBasicBlockWithSingleSuccessor(SILBasicBlock *BB,
369369
// DeadEndBlocks
370370
//===----------------------------------------------------------------------===//
371371

372+
// Force the compiler to generate the destructor in this C++ file.
373+
// Otherwise it can happen that it is generated in a SwiftCompilerSources module
374+
// and that results in unresolved-symbols linker errors.
375+
DeadEndBlocks::~DeadEndBlocks() {}
376+
372377
// Propagate the reachability up the control flow graph.
373378
void DeadEndBlocks::propagateNewlyReachableBlocks(unsigned startIdx) {
374379
for (unsigned idx = startIdx; idx < reachableBlocks.size(); ++idx) {

0 commit comments

Comments
 (0)