diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-28 21:31:09 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-28 21:31:09 +0000 |
commit | 8a3e39ab67222f6f2c1e6954c6536ad53414ab27 (patch) | |
tree | 070f4460cb0324f2aae8ddeaccc649851a6dc431 /clang/lib/Serialization/ASTReader.cpp | |
parent | 70b895908c0f1a1cb15b9cbe6e8c1470f439f2bc (diff) | |
download | bcm5719-llvm-8a3e39ab67222f6f2c1e6954c6536ad53414ab27.tar.gz bcm5719-llvm-8a3e39ab67222f6f2c1e6954c6536ad53414ab27.zip |
[modules] If both a module file and a module map for the same module are
explicitly provided, and the module map lists a header that does not exist,
unmark the module as 'unavailable' when loading its .pcm file. (Use of the
module might still fail if the relevant headers aren't embedded, but this
behavior is now consistent with how we behave if the module map is not
provided, and with the desired behavior for embedding headers in modules.)
llvm-svn: 264664
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 9b118d56f10..c0517e7db81 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -4541,14 +4541,25 @@ ASTReader::ReadSubmoduleBlock(ModuleFile &F, unsigned ClientLoadCapabilities) { SubmodulesLoaded[GlobalIndex] = CurrentModule; - // Clear out data that will be replaced by what is the module file. + // Clear out data that will be replaced by what is in the module file. CurrentModule->LinkLibraries.clear(); CurrentModule->ConfigMacros.clear(); CurrentModule->UnresolvedConflicts.clear(); CurrentModule->Conflicts.clear(); + + // The module is available unless it's missing a requirement; relevant + // requirements will be (re-)added by SUBMODULE_REQUIRES records. + // Missing headers that were present when the module was built do not + // make it unavailable -- if we got this far, this must be an explicitly + // imported module file. + CurrentModule->Requirements.clear(); + CurrentModule->MissingHeaders.clear(); + CurrentModule->IsMissingRequirement = + ParentModule && ParentModule->IsMissingRequirement; + CurrentModule->IsAvailable = !CurrentModule->IsMissingRequirement; break; } - + case SUBMODULE_UMBRELLA_HEADER: { std::string Filename = Blob; ResolveImportedPath(F, Filename); |