Question about the lifetime of SILModule in LLDB+Swift REPL implementation

LLDB-Swift Folks,

I have a question about the underlying implementation of LLDB+Swift REPL. Specifically, I am trying to understand how long the SIL module that is generated for the currently evaluated line is kept around. As far as I understand, here is what REPL does for a given input:

  • Parses the given input into a SIL module
  • Performs type checking and other sanity checks
  • Lowers the SIL Module to LLVM IR
  • Throws away the SIL module.

Is my understanding about the lifetime of the generated SIL module correct?