diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-30 17:37:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-30 17:37:44 +0000 |
| commit | 550ae89a710bf458d47e5b1d183f5e7039c2b384 (patch) | |
| tree | 4eab680d9198cddf87acb23a14c836472b21ae89 /lib/Lex/Preprocessor.cpp | |
| parent | b5aee35cc5d62f11d98539f62e4fe63f0ac9edc6 (diff) | |
Notes
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
| -rw-r--r-- | lib/Lex/Preprocessor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index dce8c1efda23..3596337c245e 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -150,6 +150,9 @@ Preprocessor::Preprocessor(std::shared_ptr<PreprocessorOptions> 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() { |
