diff options
author | Volodymyr Sapsai <vsapsai@apple.com> | 2022-09-19 17:46:01 -0700 |
---|---|---|
committer | Volodymyr Sapsai <vsapsai@apple.com> | 2022-09-20 17:55:37 -0700 |
commit | e12f6c26c394bd5b49e7c1e1c157bcee3a33d1de (patch) | |
tree | db7e4583732a94ca3d3132cc27614beaa024298b /clang/lib/Serialization/ModuleManager.cpp | |
parent | 7a239200e673c4e4c0c6d87cd35bce5bac2d44a7 (diff) | |
download | llvm-e12f6c26c394bd5b49e7c1e1c157bcee3a33d1de.zip llvm-e12f6c26c394bd5b49e7c1e1c157bcee3a33d1de.tar.gz llvm-e12f6c26c394bd5b49e7c1e1c157bcee3a33d1de.tar.bz2 |
[modules] Fix error "malformed or corrupted AST file: 'SourceLocation remap refers to unknown module...'".
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
Differential Revision: https://reviews.llvm.org/D134249
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 4fd217c..544dac1 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -249,7 +249,7 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, return NewlyLoaded; } -void ModuleManager::removeModules(ModuleIterator First, ModuleMap *modMap) { +void ModuleManager::removeModules(ModuleIterator First) { auto Last = end(); if (First == Last) return; @@ -280,19 +280,10 @@ void ModuleManager::removeModules(ModuleIterator First, ModuleMap *modMap) { } } - // Delete the modules and erase them from the various structures. - for (ModuleIterator victim = First; victim != Last; ++victim) { + // Delete the modules. + for (ModuleIterator victim = First; victim != Last; ++victim) Modules.erase(victim->File); - if (modMap) { - StringRef ModuleName = victim->ModuleName; - if (Module *mod = modMap->findModule(ModuleName)) { - mod->setASTFile(None); - } - } - } - - // Delete the modules. Chain.erase(Chain.begin() + (First - begin()), Chain.end()); } |