From 550ae89a710bf458d47e5b1d183f5e7039c2b384 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 30 May 2017 17:37:44 +0000 Subject: Vendor import of clang trunk r304222: https://llvm.org/svn/llvm-project/cfe/trunk@304222 --- lib/Lex/Preprocessor.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Lex/Preprocessor.cpp') diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index dce8c1efda23d..3596337c245e0 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -150,6 +150,9 @@ Preprocessor::Preprocessor(std::shared_ptr PPOpts, Ident_GetExceptionInfo = Ident_GetExceptionCode = nullptr; Ident_AbnormalTermination = nullptr; } + + if (this->PPOpts->GeneratePreamble) + PreambleConditionalStack.startRecording(); } Preprocessor::~Preprocessor() { @@ -532,6 +535,12 @@ void Preprocessor::EnterMainSourceFile() { // Start parsing the predefines. EnterSourceFile(FID, nullptr, SourceLocation()); + + // Restore the conditional stack from the preamble, if there is one. + if (PreambleConditionalStack.isReplaying()) { + CurPPLexer->setConditionalLevels(PreambleConditionalStack.getStack()); + PreambleConditionalStack.doneReplaying(); + } } void Preprocessor::EndSourceFile() { -- cgit v1.3