mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Preserve @_implementationOnly through module merging
When we build incrementally, we produce "partial swiftmodules" for each input source file, then merge them together into the final compiled module that, among other things, gets used for debugging. Without this, we'd drop @_implementationOnly imports and any types from the modules that were imported during the module-merging step and then be unable to debug those types
This commit is contained in:
@@ -366,7 +366,7 @@ FileUnit *SerializedModuleLoaderBase::loadAST(
|
||||
ModuleDecl &M, Optional<SourceLoc> diagLoc,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
|
||||
bool isFramework) {
|
||||
bool isFramework, bool treatAsPartialModule) {
|
||||
assert(moduleInputBuffer);
|
||||
|
||||
StringRef moduleBufferID = moduleInputBuffer->getBufferIdentifier();
|
||||
@@ -402,7 +402,8 @@ FileUnit *SerializedModuleLoaderBase::loadAST(
|
||||
|
||||
auto diagLocOrInvalid = diagLoc.getValueOr(SourceLoc());
|
||||
loadInfo.status =
|
||||
loadedModuleFile->associateWithFileContext(fileUnit, diagLocOrInvalid);
|
||||
loadedModuleFile->associateWithFileContext(fileUnit, diagLocOrInvalid,
|
||||
treatAsPartialModule);
|
||||
if (loadInfo.status == serialization::Status::Valid) {
|
||||
Ctx.bumpGeneration();
|
||||
LoadedModuleFiles.emplace_back(std::move(loadedModuleFile),
|
||||
@@ -656,7 +657,8 @@ ModuleDecl *SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
|
||||
SWIFT_DEFER { M->setHasResolvedImports(); };
|
||||
|
||||
if (!loadAST(*M, moduleID.second, std::move(moduleInputBuffer),
|
||||
std::move(moduleDocInputBuffer), isFramework)) {
|
||||
std::move(moduleDocInputBuffer), isFramework,
|
||||
/*treatAsPartialModule*/false)) {
|
||||
M->setFailedToLoad();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user