From dc9fdaf2171cc480300d5572606a8ede1678d18b Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 24 May 2013 05:44:08 +0000 Subject: [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 --- clang/lib/Lex/Lexer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Lex/Lexer.cpp') diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index e58581ee06b..e3daf346926 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -3426,6 +3426,12 @@ HandleDirective: FormTokenWithChars(Result, CurPtr, tok::hash); PP->HandleDirective(Result); + if (PP->hadModuleLoaderFatalFailure()) { + // With a fatal failure in the module loader, we abort parsing. + assert(Result.is(tok::eof) && "Preprocessor did not set tok:eof"); + return; + } + // As an optimization, if the preprocessor didn't switch lexers, tail // recurse. if (PP->isCurrentLexer(this)) { -- cgit v1.2.3