diff options
author | Daniel Jasper <djasper@google.com> | 2016-12-04 22:34:37 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-12-04 22:34:37 +0000 |
commit | ad3ba6be31cfab92038a5305d861b066634bface (patch) | |
tree | 9ebb2115b7d339cf2f2fac20f6d61b388579fd50 /clang/lib/Lex | |
parent | 11b932b0d95589365c4d09ed51d3570d4f965242 (diff) | |
download | bcm5719-llvm-ad3ba6be31cfab92038a5305d861b066634bface.tar.gz bcm5719-llvm-ad3ba6be31cfab92038a5305d861b066634bface.zip |
Revert "Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually."
This reverts commit r288449.
I believe that this is currently faulty wrt. modules being imported
inside namespaces. Adding these lines to the new test:
namespace n {
#include "foo.h"
}
Makes it break with
fatal error: import of module 'M' appears within namespace 'n'
However, I believe it should fail with
error: redundant #include of module 'M' appears within namespace 'n'
I have tracked this down to us now inserting a tok::annot_module_begin
instead of a tok::annot_module_include in
Preprocessor::HandleIncludeDirective() and then later in
Parser::parseMisplacedModuleImport(), we hit the code path for
tok::annot_module_begin, which doesn't set FromInclude of
checkModuleImportContext to true (thus leading to the "wrong"
diagnostic).
llvm-svn: 288626
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 85504de3d15..7fc008274bd 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1866,7 +1866,10 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // unavailable, diagnose the situation and bail out. // FIXME: Remove this; loadModule does the same check (but produces // slightly worse diagnostics). - if (!SuggestedModule.getModule()->isAvailable()) { + if (!SuggestedModule.getModule()->isAvailable() && + !SuggestedModule.getModule() + ->getTopLevelModule() + ->HasIncompatibleModuleFile) { Module::Requirement Requirement; Module::UnresolvedHeaderDirective MissingHeader; Module *M = SuggestedModule.getModule(); @@ -1915,12 +1918,9 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, else if (Imported.isMissingExpected()) { // We failed to find a submodule that we assumed would exist (because it // was in the directory of an umbrella header, for instance), but no - // actual module containing it exists (because the umbrella header is + // actual module exists for it (because the umbrella header is // incomplete). Treat this as a textual inclusion. SuggestedModule = ModuleMap::KnownHeader(); - } else if (Imported.isConfigMismatch()) { - // On a configuration mismatch, enter the header textually. We still know - // that it's part of the corresponding module. } else { // We hit an error processing the import. Bail out. if (hadModuleLoaderFatalFailure()) { |