[silgen] Extract out two subroutines from getSILFunction() to improve readability.
[silgen] Extract out two subroutines from getSILFunction() to improve readability.

Specifically, I extracted out:

1. updateResultTypeForForeignError
2. lowerCaptureContextParameters

getSILFunction() is really large and busy. This extracts out the busy parts and
slims getSILFunction() down a lot. I find this makes what the function is doing
clearer.

rdar://34222540

harlanhaskins/swift,glessard/swift,brentdax/swift,harlanhaskins/swift,frootloops/swift,sschiau/swift,stephentyrone/swift,allevato/swift,xedin/swift,devincoughlin/swift,ahoppen/swift,gregomni/swift,shajrawi/swift,benlangmuir/swift,glessard/swift,CodaFi/swift,CodaFi/swift,shahmishal/swift,sschiau/swift,shajrawi/swift,atrick/swift,tkremenek/swift,roambotics/swift,xedin/swift,gregomni/swift,devincoughlin/swift,lorentey/swift,karwa/swift,jmgc/swift,danielmartin/swift,austinzheng/swift,alblue/swift,shahmishal/swift,karwa/swift,frootloops/swift,shajrawi/swift,lorentey/swift,practicalswift/swift,atrick/swift,amraboelela/swift,karwa/swift,hooman/swift,practicalswift/swift,CodaFi/swift,apple/swift,harlanhaskins/swift,alblue/swift,ahoppen/swift,austinzheng/swift,tjw/swift,nathawes/swift,CodaFi/swift,benlangmuir/swift,jmgc/swift,aschwaighofer/swift,jmgc/swift,amraboelela/swift,huonw/swift,jopamer/swift,natecook1000/swift,sschiau/swift,airspeedswift/swift,aschwaighofer/swift,huonw/swift,brentdax/swift,danielmartin/swift,atrick/swift,atrick/swift,practicalswift/swift,benlangmuir/swift,xwu/swift,alblue/swift,natecook1000/swift,tkremenek/swift,karwa/swift,JGiola/swift,austinzheng/swift,practicalswift/swift,shajrawi/swift,brentdax/swift,brentdax/swift,shahmishal/swift,benlangmuir/swift,zisko/swift,tkremenek/swift,jopamer/swift,allevato/swift,zisko/swift,JGiola/swift,danielmartin/swift,devincoughlin/swift,shajrawi/swift,frootloops/swift,natecook1000/swift,apple/swift,tkremenek/swift,lorentey/swift,hooman/swift,hooman/swift,apple/swift,jckarter/swift,parkera/swift,tjw/swift,sschiau/swift,allevato/swift,JGiola/swift,parkera/swift,atrick/swift,amraboelela/swift,xedin/swift,ahoppen/swift,tjw/swift,zisko/swift,airspeedswift/swift,huonw/swift,huonw/swift,aschwaighofer/swift,jckarter/swift,jmgc/swift,huonw/swift,gribozavr/swift,parkera/swift,harlanhaskins/swift,jopamer/swift,rudkx/swift,karwa/swift,rudkx/swift,natecook1000/swift,aschwaighofer/swift,natecook1000/swift,parkera/swift,sschiau/swift,karwa/swift,rudkx/swift,atrick/swift,xedin/swift,allevato/swift,brentdax/swift,jopamer/swift,jmgc/swift,stephentyrone/swift,nathawes/swift,tjw/swift,glessard/swift,parkera/swift,huonw/swift,gregomni/swift,xwu/swift,CodaFi/swift,xwu/swift,nathawes/swift,practicalswift/swift,tkremenek/swift,hooman/swift,gribozavr/swift,glessard/swift,huonw/swift,stephentyrone/swift,allevato/swift,xedin/swift,jckarter/swift,stephentyrone/swift,alblue/swift,CodaFi/swift,tjw/swift,jckarter/swift,lorentey/swift,parkera/swift,lorentey/swift,danielmartin/swift,devincoughlin/swift,xwu/swift,jopamer/swift,brentdax/swift,nathawes/swift,amraboelela/swift,airspeedswift/swift,austinzheng/swift,amraboelela/swift,jckarter/swift,lorentey/swift,shahmishal/swift,ahoppen/swift,shajrawi/swift,alblue/swift,harlanhaskins/swift,shajrawi/swift,jckarter/swift,jopamer/swift,danielmartin/swift,jopamer/swift,benlangmuir/swift,lorentey/swift,austinzheng/swift,gregomni/swift,parkera/swift,danielmartin/swift,zisko/swift,allevato/swift,airspeedswift/swift,natecook1000/swift,tkremenek/swift,karwa/swift,zisko/swift,roambotics/swift,lorentey/swift,gribozavr/swift,tjw/swift,parkera/swift,JGiola/swift,brentdax/swift,danielmartin/swift,jmgc/swift,xedin/swift,zisko/swift,stephentyrone/swift,amraboelela/swift,shahmishal/swift,xwu/swift,alblue/swift,practicalswift/swift,gregomni/swift,shahmishal/swift,rudkx/swift,shajrawi/swift,harlanhaskins/swift,airspeedswift/swift,sschiau/swift,alblue/swift,devincoughlin/swift,hooman/swift,CodaFi/swift,rudkx/swift,gregomni/swift,apple/swift,devincoughlin/swift,gribozavr/swift,JGiola/swift,amraboelela/swift,airspeedswift/swift,tjw/swift,frootloops/swift,airspeedswift/swift,aschwaighofer/swift,gribozavr/swift,natecook1000/swift,nathawes/swift,roambotics/swift,gribozavr/swift,tkremenek/swift,devincoughlin/swift,practicalswift/swift,frootloops/swift,zisko/swift,benlangmuir/swift,hooman/swift,ahoppen/swift,gribozavr/swift,apple/swift,hooman/swift,karwa/swift,stephentyrone/swift,aschwaighofer/swift,shahmishal/swift,glessard/swift,JGiola/swift,devincoughlin/swift,apple/swift,jckarter/swift,ahoppen/swift,roambotics/swift,jmgc/swift,sschiau/swift,xedin/swift,sschiau/swift,allevato/swift,aschwaighofer/swift,roambotics/swift,roambotics/swift,frootloops/swift,austinzheng/swift,xedin/swift,austinzheng/swift,gribozavr/swift,frootloops/swift,xwu/swift,xwu/swift,rudkx/swift,stephentyrone/swift,nathawes/swift,shahmishal/swift,harlanhaskins/swift,glessard/swift,nathawes/swift,practicalswift/swift