diff options
author | Erik Verbruggen <erikjv@me.com> | 2017-07-05 09:44:07 +0000 |
---|---|---|
committer | Erik Verbruggen <erikjv@me.com> | 2017-07-05 09:44:07 +0000 |
commit | 795eee96b3c60bbfbdfafba1d8562db07d82b3a9 (patch) | |
tree | f8413a04fbfe61d9728cf9798e532e335f321be7 /clang/lib/Lex | |
parent | d93a35ae40bc44e1bae4af69c6b10ba76846781a (diff) | |
download | bcm5719-llvm-795eee96b3c60bbfbdfafba1d8562db07d82b3a9.tar.gz bcm5719-llvm-795eee96b3c60bbfbdfafba1d8562db07d82b3a9.zip |
Fix invalid warnings for header guards in preambles
Fixes https://bugs.llvm.org/show_bug.cgi?id=33574
Differential Revision: https://reviews.llvm.org/D34882
llvm-svn: 307134
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 2 |
3 files changed, 3 insertions, 7 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 012189aa6f9..61bcef8cb76 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2550,7 +2550,7 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { return true; } - if (PP->isRecordingPreamble() && !PP->isInMainFile()) { + if (PP->isRecordingPreamble() && PP->isInPrimaryFile()) { PP->setRecordedPreambleConditionalStack(ConditionalStack); ConditionalStack.clear(); } diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 1c0cd563683..5a589d6a17b 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -46,12 +46,6 @@ bool Preprocessor::isInPrimaryFile() const { }); } -bool Preprocessor::isInMainFile() const { - if (IsFileLexer()) - return IncludeMacroStack.size() == 0; - return true; -} - /// getCurrentLexer - Return the current file lexer being lexed from. Note /// that this ignores any potentially active macro expansions and _Pragma /// expansions going on at the time. diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index f9a399cd7fd..63f39524d12 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -535,7 +535,9 @@ void Preprocessor::EnterMainSourceFile() { // Start parsing the predefines. EnterSourceFile(FID, nullptr, SourceLocation()); +} +void Preprocessor::replayPreambleConditionalStack() { // Restore the conditional stack from the preamble, if there is one. if (PreambleConditionalStack.isReplaying()) { CurPPLexer->setConditionalLevels(PreambleConditionalStack.getStack()); |