diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-20 00:28:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-20 00:28:52 +0000 |
commit | 98a52db80c80fb45adb65a341c1dae62dcc364a2 (patch) | |
tree | 0ec00c68dea7a0616b3eba390f2e7e191510e4b7 /clang/lib/Lex/PPDirectives.cpp | |
parent | 9eb3f00406abcb3498b3e5e702eb69a9612a88bc (diff) | |
download | bcm5719-llvm-98a52db80c80fb45adb65a341c1dae62dcc364a2.tar.gz bcm5719-llvm-98a52db80c80fb45adb65a341c1dae62dcc364a2.zip |
Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.
Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.
llvm-svn: 146933
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 7c8bfd7e7cd..4d700aef03b 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1388,11 +1388,12 @@ 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; - TheModuleLoader.loadModule(IncludeTok.getLocation(), Path, Visibility, - /*IsIncludeDirective=*/true); + Module *Imported + = TheModuleLoader.loadModule(IncludeTok.getLocation(), Path, Visibility, + /*IsIncludeDirective=*/true); // If this header isn't part of the module we're building, we're done. - if (!BuildingImportedModule) + if (!BuildingImportedModule && Imported) return; } |