[modules] When an incompatible module file is explicitly provided for a module,

and we fall back to textual inclusion, don't require the module as a whole to
be marked available; it's OK if some other file in the same module is missing,
just as it would be if the header were explicitly marked textual.

llvm-svn: 266113
This commit is contained in:
Richard Smith 2016-04-12 19:58:30 +00:00
parent 4c3fa5f955
commit 58df343b76
2 changed files with 8 additions and 2 deletions

View File

@ -1675,7 +1675,10 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
getLangOpts().CurrentModule) {
// If this include corresponds to a module but that module is
// unavailable, diagnose the situation and bail out.
if (!SuggestedModule.getModule()->isAvailable()) {
// FIXME: Remove this; loadModule does the same check (but produces
// slightly worse diagnostics).
if (!SuggestedModule.getModule()->isAvailable() &&
!SuggestedModule.getModule()->HasIncompatibleModuleFile) {
clang::Module::Requirement Requirement;
clang::Module::UnresolvedHeaderDirective MissingHeader;
Module *M = SuggestedModule.getModule();

View File

@ -18,7 +18,7 @@
// RUN: -fmodules-embed-all-files
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s
// RUN: rm %t/modulemap
// RUN: mv %t/modulemap %t/modulemap.moved
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s
// RUN: rm %t/other.modulemap
@ -32,6 +32,9 @@
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/b.pcm %s
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s --check-prefix=MISSING-B
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved %s
// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z %s
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z -Wno-module-file-config-mismatch %s -Db=a
// RUN: rm %t/a.h
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -verify
// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/b.pcm %s -verify