Some tweaks to module import to get the demo flow working.

Swift SVN r1625
This commit is contained in:
Eli Friedman
2012-04-25 07:29:31 +00:00
parent d228618b8d
commit 2f3ff69d41
2 changed files with 7 additions and 7 deletions

View File

@@ -66,7 +66,6 @@ static bool IRGenImportedModules(TranslationUnit *TU,
&ImportedModules,
irgen::Options &Options) {
// IRGen the modules this module depends on.
llvm::SmallVector<llvm::Function*, 4> InitFuncs;
for (auto ModPair : TU->getImportedModules()) {
if (isa<BuiltinModule>(ModPair.second))
continue;
@@ -75,6 +74,9 @@ static bool IRGenImportedModules(TranslationUnit *TU,
if (!ImportedModules.insert(SubTU))
continue;
// Recursively IRGen imported modules.
IRGenImportedModules(SubTU, EE, Module, ImportedModules, Options);
// FIXME: Need to check whether this is actually safe in general.
llvm::Module SubModule(SubTU->Name.str(), Module.getContext());
performCaptureAnalysis(SubTU);
@@ -98,12 +100,9 @@ static bool IRGenImportedModules(TranslationUnit *TU,
StringRef InitFnName = (SubTU->Name.str() + ".init").toStringRef(NameBuf);
llvm::Function *InitFn = Module.getFunction(InitFnName);
if (InitFn)
InitFuncs.push_back(InitFn);
EE->runFunctionAsMain(InitFn, std::vector<std::string>(), 0);
}
for (auto InitFn : InitFuncs)
EE->runFunctionAsMain(InitFn, std::vector<std::string>(), 0);
return false;
}