mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
refactor the interface to RunImmediately to pass down the CompilerInstance,
instead of a few parts of it. No functionality change. Swift SVN r7567
This commit is contained in:
@@ -277,23 +277,22 @@ static bool IRGenImportedModules(TranslationUnit *TU,
|
|||||||
return hadError;
|
return hadError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swift::RunImmediately(irgen::Options &Options,
|
void swift::RunImmediately(CompilerInstance &CI, const ProcessCmdLine &CmdLine,
|
||||||
TranslationUnit *TU,
|
irgen::Options &Options) {
|
||||||
const ProcessCmdLine &CmdLine, SILModule *SILMod) {
|
ASTContext &Context = CI.getASTContext();
|
||||||
ASTContext &Context = TU->Ctx;
|
|
||||||
|
|
||||||
// IRGen the main module.
|
// IRGen the main module.
|
||||||
llvm::LLVMContext LLVMContext;
|
llvm::LLVMContext LLVMContext;
|
||||||
llvm::Module Module(TU->Name.str(), LLVMContext);
|
llvm::Module Module(CI.getTU()->Name.str(), LLVMContext);
|
||||||
performIRGeneration(Options, &Module, TU, SILMod);
|
performIRGeneration(Options, &Module, CI.getTU(), CI.getSILModule());
|
||||||
|
|
||||||
if (Context.hadError())
|
if (Context.hadError())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SmallVector<llvm::Function*, 8> InitFns;
|
SmallVector<llvm::Function*, 8> InitFns;
|
||||||
llvm::SmallPtrSet<TranslationUnit*, 8> ImportedModules;
|
llvm::SmallPtrSet<TranslationUnit*, 8> ImportedModules;
|
||||||
if (IRGenImportedModules(TU, Module, CmdLine, ImportedModules, InitFns, Options,
|
if (IRGenImportedModules(CI.getTU(), Module, CmdLine, ImportedModules,
|
||||||
/*IsREPL*/false))
|
InitFns, Options, /*IsREPL*/false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
llvm::PassManagerBuilder PMBuilder;
|
llvm::PassManagerBuilder PMBuilder;
|
||||||
|
|||||||
@@ -52,11 +52,8 @@ namespace swift {
|
|||||||
bool RanREPLApplicationMain;
|
bool RanREPLApplicationMain;
|
||||||
};
|
};
|
||||||
|
|
||||||
void RunImmediately(irgen::Options &Options,
|
void RunImmediately(CompilerInstance &CI, const ProcessCmdLine &CmdLine,
|
||||||
TranslationUnit *TU,
|
irgen::Options &Options);
|
||||||
const ProcessCmdLine &CmdLine,
|
|
||||||
SILModule *SILMod = nullptr
|
|
||||||
);
|
|
||||||
|
|
||||||
void REPL(CompilerInstance &CI, const ProcessCmdLine &CmdLine);
|
void REPL(CompilerInstance &CI, const ProcessCmdLine &CmdLine);
|
||||||
void REPLRunLoop(CompilerInstance &CI, const ProcessCmdLine &CmdLine);
|
void REPLRunLoop(CompilerInstance &CI, const ProcessCmdLine &CmdLine);
|
||||||
|
|||||||
Reference in New Issue
Block a user