diff options
Diffstat (limited to 'lib/Lex/PPDirectives.cpp')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 50b161a172..89490a3f23 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1483,7 +1483,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // If this was an #__include_macros directive, only make macros visible. Module::NameVisibilityKind Visibility = (IncludeKind == 3)? Module::MacrosVisible : Module::AllVisible; - Module *Imported + ModuleLoadResult Imported = TheModuleLoader.loadModule(IncludeTok.getLocation(), Path, Visibility, /*IsIncludeDirective=*/true); assert((Imported == 0 || Imported == SuggestedModule) && @@ -1498,6 +1498,13 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, } return; } + + // If we failed to find a submodule that we expected to find, we can + // continue. Otherwise, there's an error in the included file, so we + // don't want to include it. + if (!BuildingImportedModule && !Imported.isMissingExpected()) { + return; + } } if (Callbacks && SuggestedModule) { |