[SIL] Infer isWholeModule() from associated context

Rather than maintain a separate bit, check if the
associated decl context is for the ModuleDecl.
This commit is contained in:
Hamish Knight
2020-05-10 19:56:12 -07:00
parent 2d9b63ed11
commit 27ed8b0b43
6 changed files with 13 additions and 30 deletions

View File

@@ -93,12 +93,11 @@ class SILModule::SerializationCallback final
};
SILModule::SILModule(ModuleDecl *SwiftModule, TypeConverter &TC,
const SILOptions &Options, const DeclContext *associatedDC,
bool wholeModule)
const SILOptions &Options, const DeclContext *associatedDC)
: TheSwiftModule(SwiftModule),
AssociatedDeclContext(associatedDC),
Stage(SILStage::Raw), wholeModule(wholeModule), Options(Options),
serialized(false), SerializeSILAction(), Types(TC) {
Stage(SILStage::Raw), Options(Options), serialized(false),
SerializeSILAction(), Types(TC) {
assert(AssociatedDeclContext);
// We always add the base SILModule serialization callback.
@@ -125,10 +124,9 @@ SILModule::~SILModule() {
}
std::unique_ptr<SILModule>
SILModule::createEmptyModule(ModuleDecl *M, TypeConverter &TC, const SILOptions &Options,
bool WholeModule) {
return std::unique_ptr<SILModule>(
new SILModule(M, TC, Options, M, WholeModule));
SILModule::createEmptyModule(ModuleDecl *M, TypeConverter &TC,
const SILOptions &Options) {
return std::unique_ptr<SILModule>(new SILModule(M, TC, Options, M));
}
ASTContext &SILModule::getASTContext() const {