summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-05-24 05:44:08 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-05-24 05:44:08 +0000
commitdc9fdaf2171cc480300d5572606a8ede1678d18b (patch)
treedf9549534016f49322087b6780ade57739f298ae /clang/lib/Lex/Lexer.cpp
parentaa7906815724171e3f81d71fb9b12fd13b845311 (diff)
downloadbcm5719-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/Lexer.cpp')
-rw-r--r--clang/lib/Lex/Lexer.cpp6
1 files changed, 6 insertions, 0 deletions
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)) {
OpenPOWER on IntegriCloud