SIL: Share TypeConverter between SILModules in batch mode

This commit is contained in:
Slava Pestov
2019-08-27 21:58:38 -04:00
parent d434188157
commit 01e65e18c4
16 changed files with 71 additions and 37 deletions

View File

@@ -55,6 +55,10 @@ class SerializedModuleLoader;
class MemoryBufferSerializedModuleLoader;
class SILModule;
namespace Lowering {
class TypeConverter;
}
/// The abstract configuration of the compiler, including:
/// - options for all stages of translation,
/// - information about the build environment,
@@ -372,6 +376,7 @@ class CompilerInstance {
SourceManager SourceMgr;
DiagnosticEngine Diagnostics{SourceMgr};
std::unique_ptr<ASTContext> Context;
std::unique_ptr<Lowering::TypeConverter> TheSILTypes;
std::unique_ptr<SILModule> TheSILModule;
std::unique_ptr<PersistentParserState> PersistentState;
@@ -422,8 +427,6 @@ class CompilerInstance {
bool isWholeModuleCompilation() { return PrimaryBufferIDs.empty(); }
void createSILModule();
public:
// Out of line to avoid having to import SILModule.h.
CompilerInstance();
@@ -448,6 +451,10 @@ public:
SILOptions &getSILOptions() { return Invocation.getSILOptions(); }
const SILOptions &getSILOptions() const { return Invocation.getSILOptions(); }
Lowering::TypeConverter &getSILTypes();
void createSILModule();
void addDiagnosticConsumer(DiagnosticConsumer *DC) {
Diagnostics.addConsumer(*DC);
}