Skip to content

Commit 0a81319

Browse files
committed
Ensure LLVM instructions are not deleted
1 parent 7d80b20 commit 0a81319

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/engine/internal/llvm/llvminstruction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ struct LLVMInstruction
104104
// Linked list
105105
LLVMInstruction *previous = nullptr;
106106
LLVMInstruction *next = nullptr;
107+
std::shared_ptr<LLVMInstruction> _next; // ensure items are not deleted
107108
};
108109

109110
} // namespace libscratchcpp

src/engine/internal/llvm/llvminstructionlist.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ void LLVMInstructionList::addInstruction(std::shared_ptr<LLVMInstruction> ins)
5555

5656
ins->previous = nullptr;
5757
ins->next = nullptr;
58+
ins->_next = nullptr;
5859
} else {
5960
m_last->next = ins.get();
61+
m_last->_next = ins;
6062
ins->previous = m_last.get();
6163
m_last = ins;
6264
}

0 commit comments

Comments
 (0)