mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Some tweaks to module import to get the demo flow working.
Swift SVN r1625
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user