SILGen: Emit an artificial toplevel for files with @UIApplicationMain classes.

If a source file contains the main class for its module, then implicitly emit a top_level_code that invokes UIApplicationMain with the name of the marked class.

Swift SVN r18088
This commit is contained in:
Joe Groff
2014-05-15 00:53:38 +00:00
parent 8ae8f2811f
commit 793fe06a34
16 changed files with 284 additions and 13 deletions

View File

@@ -220,13 +220,12 @@ lookUpWitnessTable(const ProtocolConformance *C, bool deserializeLazily) {
return {wT, Subs};
}
SILFunction *SILModule::getOrCreateSharedFunction(SILLocation loc,
StringRef name,
CanSILFunctionType type,
IsBare_t isBareSILFunction,
IsTransparent_t isTransparent) {
auto linkage = SILLinkage::Shared;
SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
StringRef name,
SILLinkage linkage,
CanSILFunctionType type,
IsBare_t isBareSILFunction,
IsTransparent_t isTransparent) {
if (auto fn = lookUpFunction(name)) {
assert(fn->getLoweredFunctionType() == type);
assert(fn->getLinkage() == linkage);
@@ -237,6 +236,15 @@ SILFunction *SILModule::getOrCreateSharedFunction(SILLocation loc,
loc, isBareSILFunction, isTransparent);
}
SILFunction *SILModule::getOrCreateSharedFunction(SILLocation loc,
StringRef name,
CanSILFunctionType type,
IsBare_t isBareSILFunction,
IsTransparent_t isTransparent) {
return getOrCreateFunction(loc, name, SILLinkage::Shared,
type, isBareSILFunction, isTransparent);
}
ArrayRef<SILType> ValueBase::getTypes() const {
// No results.
if (TypeOrTypeList.isNull())