performTypeChecking: Defer verifyAllLoadedModules in WMO mode.
performTypeChecking: Defer verifyAllLoadedModules in WMO mode.

Suggested by Jordan Rose.

Defer per-file verification in whole-module mode. Verifying imports between
files could cause the importer to cache declarations without adding them to the
ASTContext. This happens when the importer registers a declaration without a
valid TypeChecker instance, as is the case during verification. A subsequent
file may require that declaration to be fully imported (e.g. to synthesized a
function body), but since it has already been cached, it will never be added to
the ASTContext. The solution is to skip verification and avoid caching
it. Instead, loaded modules are now verified in WMO mode once during
performWholeModuleTypeChecking.

Fixes <rdar:36801676> [Edge][swift 4.1] SIL verification failed: external
declarations of SILFunctions with shared visibility is not allowed.

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