mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Assume a SILModule is whole-module when SILGen-ing from a ModuleDecl
No functionality change. Unfortunately we still need the flag in SILModule itself because of the ability to create an empty SILModule and parse SIL into it incrementally, which can happen before there's a FileUnit to use as the associated DeclContext instead of a CompilerInstance's main module.
This commit is contained in:
@@ -1602,8 +1602,7 @@ void SILGenModule::emitSourceFile(SourceFile *sf) {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
std::unique_ptr<SILModule>
|
||||
SILModule::constructSIL(ModuleDecl *mod, SILOptions &options, FileUnit *SF,
|
||||
bool isWholeModule) {
|
||||
SILModule::constructSIL(ModuleDecl *mod, SILOptions &options, FileUnit *SF) {
|
||||
SharedTimer timer("SILGen");
|
||||
const DeclContext *DC;
|
||||
if (SF) {
|
||||
@@ -1613,7 +1612,7 @@ SILModule::constructSIL(ModuleDecl *mod, SILOptions &options, FileUnit *SF,
|
||||
}
|
||||
|
||||
std::unique_ptr<SILModule> M(
|
||||
new SILModule(mod, options, DC, isWholeModule));
|
||||
new SILModule(mod, options, DC, /*wholeModule*/ SF == nullptr));
|
||||
SILGenModule SGM(*M, mod);
|
||||
|
||||
if (SF) {
|
||||
@@ -1670,13 +1669,11 @@ SILModule::constructSIL(ModuleDecl *mod, SILOptions &options, FileUnit *SF,
|
||||
}
|
||||
|
||||
std::unique_ptr<SILModule>
|
||||
swift::performSILGeneration(ModuleDecl *mod,
|
||||
SILOptions &options,
|
||||
bool wholeModuleCompilation) {
|
||||
return SILModule::constructSIL(mod, options, nullptr, wholeModuleCompilation);
|
||||
swift::performSILGeneration(ModuleDecl *mod, SILOptions &options) {
|
||||
return SILModule::constructSIL(mod, options, nullptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<SILModule>
|
||||
swift::performSILGeneration(FileUnit &sf, SILOptions &options) {
|
||||
return SILModule::constructSIL(sf.getParentModule(), options, &sf, false);
|
||||
return SILModule::constructSIL(sf.getParentModule(), options, &sf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user