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:
Chris Lattner
2013-08-26 15:50:31 +00:00
parent 4cb38a256a
commit 41ea6ac780
2 changed files with 10 additions and 14 deletions

View File

@@ -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;

View File

@@ -52,12 +52,9 @@ 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);
} }