This is an archive of the discontinued LLVM Phabricator instance.

[modules] Fix error "malformed or corrupted AST file: 'SourceLocation remap refers to unknown module...'".
ClosedPublic

Authored by vsapsai on Sep 19 2022, 6:31 PM.

Details

Summary

When a framework can be found at a new location, all references to it in
the module cache become outdated. When we try to load such outdated .pcm
file, we shouldn't change any already loaded and processed modules.

If Module has ASTFile, it means we've read its AST block already and
it is too late to undo that. If ASTFile is None, there is no value
in setting it to None again. So we don't reset ASTFile in
ModuleManager::removeModules at all.

rdar://97216258

Diff Detail

Event Timeline

vsapsai created this revision.Sep 19 2022, 6:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 6:31 PM
Herald added a subscriber: ributzka. · View Herald Transcript
vsapsai requested review of this revision.Sep 19 2022, 6:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 6:31 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vsapsai added a subscriber: Restricted Project.Sep 19 2022, 6:31 PM
ChuanqiXu accepted this revision.Sep 19 2022, 6:59 PM
ChuanqiXu added inline comments.
clang/lib/Serialization/ModuleManager.cpp
284–286

minor: we can remove the { here.

This revision is now accepted and ready to land.Sep 19 2022, 6:59 PM
bnbarham accepted this revision.Sep 20 2022, 3:01 PM

LGTM.

When we try to load such outdated .pcm file, we shouldn't change any already loaded and processed modules.

Or to put another way - we can't remove these modules because they may already have references... anywhere.

vsapsai marked an inline comment as done.Sep 20 2022, 5:57 PM

Thanks for the review!

clang/lib/Serialization/ModuleManager.cpp
284–286

Done in actual commit.