Skip to content

Commit c4b3727

Browse files
authored
Merge pull request #32577 from nkcsgexi/new-source-manager-for-module-map
ExplicitModuleLoader: use a temporary source manager for loading the explicit module map, NFC
2 parents 5300dc2 + fb99e84 commit c4b3727

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,8 +1503,10 @@ struct ExplicitSwiftModuleLoader::Implementation {
15031503
return;
15041504
}
15051505
StringRef Buffer = fileBufOrErr->get()->getBuffer();
1506-
Stream Stream(llvm::MemoryBufferRef(Buffer, fileName),
1507-
Ctx.SourceMgr.getLLVMSourceMgr());
1506+
// Use a new source manager instead of the one from ASTContext because we
1507+
// don't want the JSON file to be persistent.
1508+
llvm::SourceMgr SM;
1509+
Stream Stream(llvm::MemoryBufferRef(Buffer, fileName), SM);
15081510
for (auto DI = Stream.begin(); DI != Stream.end(); ++ DI) {
15091511
assert(DI != Stream.end() && "Failed to read a document");
15101512
if (auto *MN = dyn_cast_or_null<SequenceNode>(DI->getRoot())) {

0 commit comments

Comments
 (0)