diff options
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index c16dfb23e94..4a9e09f798e 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1660,14 +1660,18 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, } // If all is good, enter the new file! - EnterSourceFile(FID, CurDir, FilenameTok.getLocation(), - static_cast<bool>(BuildingModule)); + if (EnterSourceFile(FID, CurDir, FilenameTok.getLocation())) + return; // If we're walking into another part of the same module, let the parser // know that any future declarations are within that other submodule. - if (BuildingModule) + if (BuildingModule) { + assert(!CurSubmodule && "should not have marked this as a module yet"); + CurSubmodule = BuildingModule.getModule(); + EnterAnnotationToken(*this, HashLoc, End, tok::annot_module_begin, - BuildingModule.getModule()); + CurSubmodule); + } } /// HandleIncludeNextDirective - Implements \#include_next. |