LLDB Frontend crash

I have been blocked for several weeks with this LLDB crashing bug, but it
has not been assigned to anyone.
I'm providing repro steps with the LLDB CLI in order to remove any
possibility that it is caused by my IDE. I have had this independently
confirmed by one of the CLion engineers.

I logged the bug: [SR-5226] LLDBFrontend crash in getTypeLoweringForUncachedLoweredType · Issue #4629 · apple/llvm-project · GitHub

I would really appreciate this being fixed so my development can continue.

thanks, Ed

Here is a simple 6 line repro

···

----------------------------
struct SomeStruct { }

func fetch(outputData: inout SomeStruct?) {
outputData = SomeStruct()
}

var outData: SomeStruct?

fetch(outputData: &outData)

-----------------------------

1) build the project as HelloWorld (or whatever you like)
2) then from the LLDB CLI, set a breakpoint on line 5 and run
3) then examine outputData: fr var -O outputData

This is the session output
------------------------------

$ lldb HelloWorld
(lldb) target create "HelloWorld"
Current executable set to 'HelloWorld' (x86_64).
(lldb) br se --file main.swift --line 5
Breakpoint 1: where = HelloWorld`HelloWorld.fetch(outputData: inout
Swift.Optional<HelloWorld.SomeStruct>) -> () + 28 at main.swift:5, address
= 0x0000000000400b6c
(lldb) r
Process 14669 launched:
'/home/ed/CLionProjects/untitled1/.build/debug/HelloWorld' (x86_64)
Process 14669 stopped

   - thread #1, name = 'HelloWorld', stop reason = breakpoint 1.1
   frame #0: 0x0000000000400b6c HelloWorld`fetch(outputData=some) at
   main.swift:5
   2
   3 func fetch(outputData: inout SomeStruct?) { 4 outputData =
   SomeStruct() -> 5 }

   6
   7 var outData: SomeStruct?
   8
   Target 0: (HelloWorld) stopped.
   (lldb) fr var -O outputData
   lldb:
   /home/buildnode/disk2/workspace/oss-swift-4.0-package-linux-ubuntu-16_04/swift/lib/SIL/TypeLowering.cpp:1693:
   const swift::Lowering::TypeLowering
   &swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey):
   Assertion `key.SubstType->isLegalSILType() && "type is not already
   lowered"' failed.
   Stack dump:
   0. HandleCommand(command = "fr var -O outputData")
   Aborted (core dumped)