diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-05-24 05:44:08 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-05-24 05:44:08 +0000 |
commit | dc9fdaf2171cc480300d5572606a8ede1678d18b (patch) | |
tree | df9549534016f49322087b6780ade57739f298ae /clang/lib/Lex/PPDirectives.cpp | |
parent | aa7906815724171e3f81d71fb9b12fd13b845311 (diff) | |
download | bcm5719-llvm-dc9fdaf2171cc480300d5572606a8ede1678d18b.tar.gz bcm5719-llvm-dc9fdaf2171cc480300d5572606a8ede1678d18b.zip |
[modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.
Also don't let libclang create a PCH with such an error.
Fixes rdar://13953768
llvm-svn: 182629
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index ba3291aa398..947011d7075 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1512,6 +1512,20 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, /*IsIncludeDirective=*/true); assert((Imported == 0 || Imported == SuggestedModule) && "the imported module is different than the suggested one"); + + if (!Imported && hadModuleLoaderFatalFailure()) { + // With a fatal failure in the module loader, we abort parsing. + Token &Result = IncludeTok; + if (CurLexer) { + Result.startToken(); + CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof); + CurLexer->cutOffLexing(); + } else { + assert(CurPTHLexer && "#include but no current lexer set!"); + CurPTHLexer->getEOF(Result); + } + return; + } // If this header isn't part of the module we're building, we're done. if (!BuildingImportedModule && Imported) { |